changeset 3040:a05b6580f71c

topics: handle phase correctly while changing topics
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 05 Oct 2017 19:35:58 +0530
parents 5b24ed4b3e9c
children e162597b375a
files hgext3rd/topic/__init__.py tests/test-topic-change.t
diffstat 2 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Thu Oct 05 19:30:22 2017 +0530
+++ b/hgext3rd/topic/__init__.py	Thu Oct 05 19:35:58 2017 +0530
@@ -721,17 +721,28 @@
             p1 = successors[p1][0]
         if p2 in successors:
             p2 = successors[p2][0]
-        mc = context.memctx(
-            repo, (p1, p2), c.description(),
-            c.files(), filectxfn,
-            user=c.user(), date=c.date(), extra=fixedextra)
-        newnode = repo.commitctx(mc)
+        mc = context.memctx(repo,
+                            (p1, p2),
+                            c.description(),
+                            c.files(),
+                            filectxfn,
+                            user=c.user(),
+                            date=c.date(),
+                            extra=fixedextra)
+
+        # phase handling
+        commitphase = c.phase()
+        overrides = {('phases', 'new-commit'): commitphase}
+        with repo.ui.configoverride(overrides, 'changetopic'):
+            newnode = repo.commitctx(mc)
+
         successors[c.node()] = (newnode,)
         ui.debug('new node id is %s\n' % node.hex(newnode))
         rewrote += 1
 
     # create obsmarkers and move bookmarks
     scmutil.cleanupnodes(repo, successors, 'changetopics')
+
     # move the working copy too
     wctx = repo[None]
     # in-progress merge is a bit too complex for now.
--- a/tests/test-topic-change.t	Thu Oct 05 19:30:22 2017 +0530
+++ b/tests/test-topic-change.t	Thu Oct 05 19:35:58 2017 +0530
@@ -401,7 +401,5 @@
   o  8:86a186070af2 {}
      Added a  ()
   
-XXX: the phase must be preserved and hence must be secret
-
   $ hg phase -r .
-  33: draft
+  33: secret