Patchwork D7800: movedirstate: get copies from dirstate before setting parents

login
register
mail settings
Submitter phabricator
Date Jan. 7, 2020, 12:59 a.m.
Message ID <differential-rev-PHID-DREV-46njmq2m42tqjljupcyp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44163/
State Superseded
Headers show

Comments

phabricator - Jan. 7, 2020, 12:59 a.m.
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




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

Patch

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':