##// END OF EJS Templates
absorb: consider rewrite.empty-successor configuration...
Manuel Jacob -
r45684:3ee8e2d5 default
parent child Browse files
Show More
@@ -50,6 +50,7 b' from mercurial import ('
50 50 phases,
51 51 pycompat,
52 52 registrar,
53 rewriteutil,
53 54 scmutil,
54 55 util,
55 56 )
@@ -782,8 +783,10 b' class fixupstate(object):'
782 783 # nothing changed, nothing commited
783 784 nextp1 = ctx
784 785 continue
785 if ctx.files() and self._willbecomenoop(
786 memworkingcopy, ctx, nextp1
786 if (
787 self.skip_empty_successor
788 and ctx.files()
789 and self._willbecomenoop(memworkingcopy, ctx, nextp1)
787 790 ):
788 791 # changeset is no longer necessary
789 792 self.replacemap[ctx.node()] = None
@@ -935,6 +938,10 b' class fixupstate(object):'
935 938 self.repo, replacements, operation=b'absorb', fixphase=True
936 939 )
937 940
941 @util.propertycache
942 def skip_empty_successor(self):
943 return rewriteutil.skip_empty_successor(self.ui, b'absorb')
944
938 945
939 946 def _parsechunk(hunk):
940 947 """(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline]))"""
@@ -1896,7 +1896,7 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, only the rebase command considers this configuration.
1899 Currently, only the rebase and absorb commands consider this configuration.
1900 1900 (EXPERIMENTAL)
1901 1901
1902 1902 ``storage``
@@ -490,6 +490,71 b' Remove lines may delete changesets:'
490 490 +3
491 491
492 492
493 Setting config rewrite.empty-successor=keep causes empty changesets to get committed:
494
495 $ cd ..
496 $ hg init repo4a
497 $ cd repo4a
498 $ cat > a <<EOF
499 > 1
500 > 2
501 > EOF
502 $ hg commit -m a12 -A a
503 $ cat > b <<EOF
504 > 1
505 > 2
506 > EOF
507 $ hg commit -m b12 -A b
508 $ echo 3 >> b
509 $ hg commit -m b3
510 $ echo 4 >> b
511 $ hg commit -m b4
512 $ echo 1 > b
513 $ echo 3 >> a
514 $ hg absorb -pn
515 showing changes for a
516 @@ -2,0 +2,1 @@
517 bfafb49 +3
518 showing changes for b
519 @@ -1,3 +1,0 @@
520 1154859 -2
521 30970db -3
522 a393a58 -4
523
524 4 changesets affected
525 a393a58 b4
526 30970db b3
527 1154859 b12
528 bfafb49 a12
529 $ hg absorb -av --config rewrite.empty-successor=keep | grep became
530 0:bfafb49242db: 1 file(s) changed, became 4:1a2de97fc652
531 1:115485984805: 2 file(s) changed, became 5:0c930dfab74c
532 2:30970dbf7b40: 2 file(s) changed, became 6:df6574ae635c
533 3:a393a58b9a85: 2 file(s) changed, became 7:ad4bd3462c9e
534 $ hg log -T '{rev} {desc}\n' -Gp
535 @ 7 b4
536 |
537 o 6 b3
538 |
539 o 5 b12
540 | diff --git a/b b/b
541 | new file mode 100644
542 | --- /dev/null
543 | +++ b/b
544 | @@ -0,0 +1,1 @@
545 | +1
546 |
547 o 4 a12
548 diff --git a/a b/a
549 new file mode 100644
550 --- /dev/null
551 +++ b/a
552 @@ -0,0 +1,3 @@
553 +1
554 +2
555 +3
556
557
493 558 Use revert to make the current change and its parent disappear.
494 559 This should move us to the non-obsolete ancestor.
495 560
General Comments 0
You need to be logged in to leave comments. Login now