# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1507212358 -19800 # Node ID a05b6580f71c08849de9106eb67034f1833d209f # Parent 5b24ed4b3e9cba93e001a4c48a24073bc2d53a45 topics: handle phase correctly while changing topics diff -r 5b24ed4b3e9c -r a05b6580f71c hgext3rd/topic/__init__.py --- 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. diff -r 5b24ed4b3e9c -r a05b6580f71c tests/test-topic-change.t --- 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