changeset 41342:fe83040400b7

uncommit: set dirstateparents from within _fixdirstate() It's now done in the same way for uncommit and unamend, so we can share the code. Differential Revision: https://phab.mercurial-scm.org/D5662
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 20 Jan 2019 21:49:58 -0800
parents 19c590ce8661
children 7370f302be71
files hgext/uncommit.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/uncommit.py	Sun Jan 20 22:00:25 2019 -0800
+++ b/hgext/uncommit.py	Sun Jan 20 21:49:58 2019 -0800
@@ -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,)}