D5662: uncommit: set dirstateparents from within _fixdirstate()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jan 23 06:37:56 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It's now done in the same way for uncommit and unamend, so we can
  share the code.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5662

AFFECTED FILES
  hgext/uncommit.py

CHANGE DETAILS

diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -98,6 +98,7 @@
     newctx which can be result of either unamend or uncommit.
     """
     ds = repo.dirstate
+    ds.setparents(newctx.node(), node.nullid)
     copies = dict(ds.copies())
     s = newctx.status(oldctx, match=match)
     for f in s.modified:
@@ -176,7 +177,6 @@
                 mapping[old.node()] = ()
 
             with repo.dirstate.parentchange():
-                repo.dirstate.setparents(newid, node.nullid)
                 _fixdirstate(repo, old, repo[newid], match)
 
             scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True)
@@ -239,7 +239,6 @@
         dirstate = repo.dirstate
 
         with dirstate.parentchange():
-            dirstate.setparents(newprednode, node.nullid)
             _fixdirstate(repo, curctx, newpredctx)
 
         mapping = {curctx.node(): (newprednode,)}



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list