This simplifies the code.
Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG79ab5369d55a: rebase: use _ctxdesc in one more place
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
This simplifies the code.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/rebase.py (5 lines) | |||
M | tests/test-rebase-obsolete.t (26 lines) |
if self.state[rev] == rev: | if self.state[rev] == rev: | ||||
ui.status(_('already rebased %s\n') % desc) | ui.status(_('already rebased %s\n') % desc) | ||||
elif rev in self.obsoletenotrebased: | elif rev in self.obsoletenotrebased: | ||||
succ = self.obsoletenotrebased[rev] | succ = self.obsoletenotrebased[rev] | ||||
if succ is None: | if succ is None: | ||||
msg = _('note: not rebasing %s, it has no ' | msg = _('note: not rebasing %s, it has no ' | ||||
'successor\n') % desc | 'successor\n') % desc | ||||
else: | else: | ||||
succctx = repo[succ] | succdesc = _ctxdesc(repo[succ]) | ||||
succdesc = '%d:%s "%s"' % ( | |||||
succctx.rev(), succctx, | |||||
succctx.description().split('\n', 1)[0]) | |||||
msg = (_('note: not rebasing %s, already in ' | msg = (_('note: not rebasing %s, already in ' | ||||
'destination as %s\n') % (desc, succdesc)) | 'destination as %s\n') % (desc, succdesc)) | ||||
repo.ui.status(msg) | repo.ui.status(msg) | ||||
# Make clearrebased aware state[rev] is not a true successor | # Make clearrebased aware state[rev] is not a true successor | ||||
self.skipped.add(rev) | self.skipped.add(rev) | ||||
# Record rev as moved to its desired destination in self.state. | # Record rev as moved to its desired destination in self.state. | ||||
# This helps bookmark and working parent movement. | # This helps bookmark and working parent movement. | ||||
dest = max(adjustdest(repo, rev, self.destmap, self.state, | dest = max(adjustdest(repo, rev, self.destmap, self.state, |
o | 5:24b6387c8c8c F | o | 5:24b6387c8c8c F | ||||
| | | | | | ||||
| o 4:9520eea781bc E | | o 4:9520eea781bc E | ||||
|/ | |/ | ||||
o 0:cd010b8cd998 A | o 0:cd010b8cd998 A | ||||
$ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True | $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True | ||||
rebasing 8:8877864f1edb "B" | rebasing 8:8877864f1edb "B" | ||||
note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" | note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip) | ||||
rebasing 10:5ae4c968c6ac "C" | rebasing 10:5ae4c968c6ac "C" | ||||
$ hg debugobsolete | $ hg debugobsolete | ||||
42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob) | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob) | ||||
5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob) | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob) | ||||
32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob) | 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob) | ||||
08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob) | 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob) | ||||
8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob) | 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob) | ||||
5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob) | 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob) | ||||
> F | > F | ||||
> /| | > /| | ||||
> E D B # replace: D -> B | > E D B # replace: D -> B | ||||
> \|/ | > \|/ | ||||
> A | > A | ||||
> EOF | > EOF | ||||
$ hg rebase -d B -s D | $ hg rebase -d B -s D | ||||
note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" | note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B) | ||||
rebasing 4:66f1a38021c9 "F" (F tip) | rebasing 4:66f1a38021c9 "F" (F tip) | ||||
$ hg log -G | $ hg log -G | ||||
o 5:50e9d60b99c6 F | o 5:50e9d60b99c6 F | ||||
|\ | |\ | ||||
| | x 4:66f1a38021c9 F | | | x 4:66f1a38021c9 F | ||||
| |/| | | |/| | ||||
| o | 3:7fb047a69f22 E | | o | 3:7fb047a69f22 E | ||||
| | | | | | | | ||||
> F | > F | ||||
> /| | > /| | ||||
> E D B # replace: E -> B | > E D B # replace: E -> B | ||||
> \|/ | > \|/ | ||||
> A | > A | ||||
> EOF | > EOF | ||||
$ hg rebase -d B -s E | $ hg rebase -d B -s E | ||||
note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" | note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B) | ||||
rebasing 4:66f1a38021c9 "F" (F tip) | rebasing 4:66f1a38021c9 "F" (F tip) | ||||
$ hg log -G | $ hg log -G | ||||
o 5:aae1787dacee F | o 5:aae1787dacee F | ||||
|\ | |\ | ||||
| | x 4:66f1a38021c9 F | | | x 4:66f1a38021c9 F | ||||
| |/| | | |/| | ||||
| | x 3:7fb047a69f22 E | | | x 3:7fb047a69f22 E | ||||
| | | | | | | | ||||
> F C | > F C | ||||
> /| | | > /| | | ||||
> E D B # replace: D -> B | > E D B # replace: D -> B | ||||
> \|/ | > \|/ | ||||
> A | > A | ||||
> EOF | > EOF | ||||
$ hg rebase -d C -s D | $ hg rebase -d C -s D | ||||
note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" | note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B) | ||||
rebasing 5:66f1a38021c9 "F" (F tip) | rebasing 5:66f1a38021c9 "F" (F tip) | ||||
$ hg log -G | $ hg log -G | ||||
o 6:0913febf6439 F | o 6:0913febf6439 F | ||||
|\ | |\ | ||||
+---x 5:66f1a38021c9 F | +---x 5:66f1a38021c9 F | ||||
| | | | | | | | ||||
| o | 4:26805aba1e60 C | | o | 4:26805aba1e60 C | ||||
> F C | > F C | ||||
> /| | | > /| | | ||||
> E D B # replace: E -> B | > E D B # replace: E -> B | ||||
> \|/ | > \|/ | ||||
> A | > A | ||||
> EOF | > EOF | ||||
$ hg rebase -d C -s E | $ hg rebase -d C -s E | ||||
note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" | note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B) | ||||
rebasing 5:66f1a38021c9 "F" (F tip) | rebasing 5:66f1a38021c9 "F" (F tip) | ||||
$ hg log -G | $ hg log -G | ||||
o 6:c6ab0cc6d220 F | o 6:c6ab0cc6d220 F | ||||
|\ | |\ | ||||
+---x 5:66f1a38021c9 F | +---x 5:66f1a38021c9 F | ||||
| | | | | | | | ||||
| o | 4:26805aba1e60 C | | o | 4:26805aba1e60 C | ||||
| | | | | | | | ||||
> /| | | > /| | | ||||
> E D B # replace: E -> B | > E D B # replace: E -> B | ||||
> \|/ | > \|/ | ||||
> A | > A | ||||
> EOF | > EOF | ||||
$ hg rebase -d C -b F | $ hg rebase -d C -b F | ||||
rebasing 2:b18e25de2cf5 "D" (D) | rebasing 2:b18e25de2cf5 "D" (D) | ||||
note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" | note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B) | ||||
rebasing 5:66f1a38021c9 "F" (F tip) | rebasing 5:66f1a38021c9 "F" (F tip) | ||||
note: rebase of 5:66f1a38021c9 created no changes to commit | note: rebase of 5:66f1a38021c9 created no changes to commit | ||||
$ hg log -G | $ hg log -G | ||||
o 6:8f47515dda15 D | o 6:8f47515dda15 D | ||||
| | | | ||||
| x 5:66f1a38021c9 F | | x 5:66f1a38021c9 F | ||||
| |\ | | |\ | ||||
o | | 4:26805aba1e60 C | o | | 4:26805aba1e60 C | ||||
> F C | > F C | ||||
> /| | | > /| | | ||||
> E D B # replace: D -> B | > E D B # replace: D -> B | ||||
> \|/ | > \|/ | ||||
> A | > A | ||||
> EOF | > EOF | ||||
$ hg rebase -d C -b F | $ hg rebase -d C -b F | ||||
note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" | note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B) | ||||
rebasing 3:7fb047a69f22 "E" (E) | rebasing 3:7fb047a69f22 "E" (E) | ||||
rebasing 5:66f1a38021c9 "F" (F tip) | rebasing 5:66f1a38021c9 "F" (F tip) | ||||
note: rebase of 5:66f1a38021c9 created no changes to commit | note: rebase of 5:66f1a38021c9 created no changes to commit | ||||
$ hg log -G | $ hg log -G | ||||
o 6:533690786a86 E | o 6:533690786a86 E | ||||
| | | | ||||
| x 5:66f1a38021c9 F | | x 5:66f1a38021c9 F | ||||
$ hg debugdrawdag <<'EOS' | $ hg debugdrawdag <<'EOS' | ||||
> E F | > E F | ||||
> /| /| # replace: A -> C | > /| /| # replace: A -> C | ||||
> A B C D # replace: B -> D | > A B C D # replace: B -> D | ||||
> | | | > | | | ||||
> X Y | > X Y | ||||
> EOS | > EOS | ||||
$ hg rebase -r A+B+E -d F | $ hg rebase -r A+B+E -d F | ||||
note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" | note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C) | ||||
note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" | note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D) | ||||
rebasing 7:dac5d11c5a7d "E" (E tip) | rebasing 7:dac5d11c5a7d "E" (E tip) | ||||
abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f | abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f | ||||
[255] | [255] | ||||
$ cd .. | $ cd .. | ||||
Rebase a non-clean merge. One parent has successor in destination, the other | Rebase a non-clean merge. One parent has successor in destination, the other | ||||
parent moves as requested. | parent moves as requested. | ||||
$ hg init p1-succ-p2-move | $ hg init p1-succ-p2-move | ||||
$ cd p1-succ-p2-move | $ cd p1-succ-p2-move | ||||
$ hg debugdrawdag <<'EOS' | $ hg debugdrawdag <<'EOS' | ||||
> D Z | > D Z | ||||
> /| | # replace: A -> C | > /| | # replace: A -> C | ||||
> A B C # D/D = D | > A B C # D/D = D | ||||
> EOS | > EOS | ||||
$ hg rebase -r A+B+D -d Z | $ hg rebase -r A+B+D -d Z | ||||
note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" | note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C) | ||||
rebasing 1:fc2b737bb2e5 "B" (B) | rebasing 1:fc2b737bb2e5 "B" (B) | ||||
rebasing 3:b8ed089c80ad "D" (D) | rebasing 3:b8ed089c80ad "D" (D) | ||||
$ rm .hg/localtags | $ rm .hg/localtags | ||||
$ hg log -G | $ hg log -G | ||||
o 6:e4f78693cc88 D | o 6:e4f78693cc88 D | ||||
| | | | ||||
o 5:76840d832e98 B | o 5:76840d832e98 B | ||||
$ cd p1-move-p2-succ | $ cd p1-move-p2-succ | ||||
$ hg debugdrawdag <<'EOS' | $ hg debugdrawdag <<'EOS' | ||||
> D Z | > D Z | ||||
> /| | # replace: B -> C | > /| | # replace: B -> C | ||||
> A B C # D/D = D | > A B C # D/D = D | ||||
> EOS | > EOS | ||||
$ hg rebase -r B+A+D -d Z | $ hg rebase -r B+A+D -d Z | ||||
rebasing 0:426bada5c675 "A" (A) | rebasing 0:426bada5c675 "A" (A) | ||||
note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" | note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C) | ||||
rebasing 3:b8ed089c80ad "D" (D) | rebasing 3:b8ed089c80ad "D" (D) | ||||
$ rm .hg/localtags | $ rm .hg/localtags | ||||
$ hg log -G | $ hg log -G | ||||
o 6:1b355ed94d82 D | o 6:1b355ed94d82 D | ||||
| | | | ||||
o 5:a81a74d764a6 A | o 5:a81a74d764a6 A | ||||
| | | | ||||
rebasing 2:1e9a3c00cbe9 "b" (tip) | rebasing 2:1e9a3c00cbe9 "b" (tip) | ||||
$ hg log -r . # working dir is at rev 3 (successor of 2) | $ hg log -r . # working dir is at rev 3 (successor of 2) | ||||
3:be1832deae9a b (no-eol) | 3:be1832deae9a b (no-eol) | ||||
$ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now | $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now | ||||
$ hg up 2 && hg log -r . # working dir is at rev 2 again | $ hg up 2 && hg log -r . # working dir is at rev 2 again | ||||
0 files updated, 0 files merged, 1 files removed, 0 files unresolved | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
2:1e9a3c00cbe9 b (no-eol) | 2:1e9a3c00cbe9 b (no-eol) | ||||
$ hg rebase -r 2 -d 3 --config experimental.stabilization.track-operation=1 | $ hg rebase -r 2 -d 3 --config experimental.stabilization.track-operation=1 | ||||
note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" | note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip) | ||||
Check that working directory and bookmark was updated to rev 3 although rev 2 | Check that working directory and bookmark was updated to rev 3 although rev 2 | ||||
was skipped | was skipped | ||||
$ hg log -r . | $ hg log -r . | ||||
3:be1832deae9a b (no-eol) | 3:be1832deae9a b (no-eol) | ||||
$ hg bookmarks | $ hg bookmarks | ||||
mybook 3:be1832deae9a | mybook 3:be1832deae9a | ||||
$ hg debugobsolete --rev tip | $ hg debugobsolete --rev tip | ||||
1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (*) {'user': 'test'} (glob) | 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (*) {'user': 'test'} (glob) | ||||
> | B | > | B | ||||
> |/ | > |/ | ||||
> A | > A | ||||
> EOS | > EOS | ||||
$ hg update D1 -q | $ hg update D1 -q | ||||
$ hg bookmark book -i | $ hg bookmark book -i | ||||
$ hg rebase -r B+D1 -d E | $ hg rebase -r B+D1 -d E | ||||
rebasing 1:112478962961 "B" (B) | rebasing 1:112478962961 "B" (B) | ||||
note: not rebasing 5:15ecf15e0114 "D1" (D1 tip book), already in destination as 2:0807738e0be9 "D2" | note: not rebasing 5:15ecf15e0114 "D1" (D1 tip book), already in destination as 2:0807738e0be9 "D2" (D2) | ||||
$ hg log -G -T '{desc} {bookmarks}' | $ hg log -G -T '{desc} {bookmarks}' | ||||
@ B book | @ B book | ||||
| | | | ||||
| x D1 | | x D1 | ||||
| | | | | | ||||
o | E | o | E | ||||
| | | | | | ||||
| o C | | o C | ||||
| | | | | | ||||
o | D2 | o | D2 | ||||
| | | | | | ||||
| x B | | x B | ||||
|/ | |/ | ||||
o A | o A | ||||