D7800: movedirstate: get copies from dirstate before setting parents

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jan 6 19:59:31 EST 2020


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

REVISION SUMMARY
  Setting dirstate parents can modify the copies recorded in the
  dirstate when there are two dirstate parents. I don't think we ever
  call movedirstate() when there is more than one parent, but it seems
  clearer to get the copies from the dirstate first anyway.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1426,8 +1426,8 @@
     """
     oldctx = repo[b'.']
     ds = repo.dirstate
+    copies = dict(ds.copies())
     ds.setparents(newctx.node(), nullid)
-    copies = dict(ds.copies())
     s = newctx.status(oldctx, match=match)
     for f in s.modified:
         if ds[f] == b'r':



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


More information about the Mercurial-devel mailing list