grab: preserve phase of the grabbed changeset
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 02 Feb 2018 13:59:33 +0530
changeset 3475 a03bb02dfaba
parent 3474 05fe5239fca2
child 3476 1e346044c7cf
grab: preserve phase of the grabbed changeset This patch fixes the wrong behavior of loosing secret phase of the grabbed changeset.
hgext3rd/evolve/cmdrewrite.py
tests/test-grab.t
tests/test-tutorial.t
--- a/hgext3rd/evolve/cmdrewrite.py	Fri Feb 02 13:45:47 2018 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Fri Feb 02 13:59:33 2018 +0530
@@ -1224,8 +1224,11 @@
             orignode = grabstate['orignode']
             origctx = repo[orignode]
 
-        newnode = repo.commit(text=origctx.description(), user=origctx.user(),
-                              date=origctx.date(), extra=origctx.extra())
+        overrides = {('phases', 'new-commit'): origctx.phase()}
+        with repo.ui.configoverride(overrides, 'grab'):
+            newnode = repo.commit(text=origctx.description(),
+                                  user=origctx.user(),
+                                  date=origctx.date(), extra=origctx.extra())
 
         if grabstate:
             grabstate.delete()
--- a/tests/test-grab.t	Fri Feb 02 13:45:47 2018 +0530
+++ b/tests/test-grab.t	Fri Feb 02 13:59:33 2018 +0530
@@ -262,7 +262,7 @@
 
   $ hg grab --continue
   $ hg phase -r .
-  10: draft
+  10: secret
 
 No merge conflicts
 
@@ -299,4 +299,4 @@
   grabbing 11:508d572e7053 "added l"
 
   $ hg phase -r .
-  12: draft
+  12: secret
--- a/tests/test-tutorial.t	Fri Feb 02 13:45:47 2018 +0530
+++ b/tests/test-tutorial.t	Fri Feb 02 13:59:33 2018 +0530
@@ -810,7 +810,6 @@
   grabbing 8:10b8aeaa8cc8 "bathroom stuff"
   merging shopping
   $ hg phase --draft .
-  no phases changed
   $ hg log -G
   @  4710c0968793 (draft): bathroom stuff
   |