##// END OF EJS Templates
rebase: consider rewrite.empty-successor configuration...
Manuel Jacob -
r45683:1efbfa9b default
parent child Browse files
Show More
@@ -0,0 +1,44 b''
1 $ cat << EOF >> $HGRCPATH
2 > [extensions]
3 > rebase=
4 > [alias]
5 > tglog = log -G -T "{rev} '{desc}'\n"
6 > EOF
7
8 $ hg init
9
10 $ echo a > a; hg add a; hg ci -m a
11 $ echo b > b; hg add b; hg ci -m b1
12 $ hg up 0 -q
13 $ echo b > b; hg add b; hg ci -m b2 -q
14
15 $ hg tglog
16 @ 2 'b2'
17 |
18 | o 1 'b1'
19 |/
20 o 0 'a'
21
22
23 With rewrite.empty-successor=skip, b2 is skipped because it would become empty.
24
25 $ hg rebase -s 2 -d 1 --config rewrite.empty-successor=skip --dry-run
26 starting dry-run rebase; repository will not be changed
27 rebasing 2:6e2aad5e0f3c "b2" (tip)
28 note: not rebasing 2:6e2aad5e0f3c "b2" (tip), its destination already has all its changes
29 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
30
31 With rewrite.empty-successor=keep, b2 will be recreated although it became empty.
32
33 $ hg rebase -s 2 -d 1 --config rewrite.empty-successor=keep
34 rebasing 2:6e2aad5e0f3c "b2" (tip)
35 note: created empty successor for 2:6e2aad5e0f3c "b2" (tip), its destination already has all its changes
36 saved backup bundle to $TESTTMP/.hg/strip-backup/6e2aad5e0f3c-7d7c8801-rebase.hg
37
38 $ hg tglog
39 @ 2 'b2'
40 |
41 o 1 'b1'
42 |
43 o 0 'a'
44
@@ -206,6 +206,9 b' class rebaseruntime(object):'
206 206 self.backupf = ui.configbool(b'rewrite', b'backup-bundle')
207 207 self.keepf = opts.get(b'keep', False)
208 208 self.keepbranchesf = opts.get(b'keepbranches', False)
209 self.skipemptysuccessorf = rewriteutil.skip_empty_successor(
210 repo.ui, b'rebase'
211 )
209 212 self.obsoletenotrebased = {}
210 213 self.obsoletewithoutsuccessorindestination = set()
211 214 self.inmemory = inmemory
@@ -530,7 +533,10 b' class rebaseruntime(object):'
530 533 for c in self.extrafns:
531 534 c(ctx, extra)
532 535 destphase = max(ctx.phase(), phases.draft)
533 overrides = {(b'phases', b'new-commit'): destphase}
536 overrides = {
537 (b'phases', b'new-commit'): destphase,
538 (b'ui', b'allowemptycommit'): not self.skipemptysuccessorf,
539 }
534 540 with repo.ui.configoverride(overrides, b'rebase'):
535 541 if self.inmemory:
536 542 newnode = commitmemorynode(
@@ -650,6 +656,14 b' class rebaseruntime(object):'
650 656 if newnode is not None:
651 657 self.state[rev] = repo[newnode].rev()
652 658 ui.debug(b'rebased as %s\n' % short(newnode))
659 if repo[newnode].isempty():
660 ui.warn(
661 _(
662 b'note: created empty successor for %s, its '
663 b'destination already has all its changes\n'
664 )
665 % desc
666 )
653 667 else:
654 668 if not self.collapsef:
655 669 ui.warn(
@@ -1896,7 +1896,8 b' Alias definitions for revsets. See :hg:`'
1896 1896 operations. If set to ``skip``, the successor is not created. If set to
1897 1897 ``keep``, the empty successor is created and kept.
1898 1898
1899 Currently, no command considers this configuration. (EXPERIMENTAL)
1899 Currently, only the rebase command considers this configuration.
1900 (EXPERIMENTAL)
1900 1901
1901 1902 ``storage``
1902 1903 -----------
General Comments 0
You need to be logged in to leave comments. Login now