Patchwork D11210: fix: use scmutil.movedirstate() instead of reimplementing

login
register
mail settings
Submitter phabricator
Date July 23, 2021, 7:17 a.m.
Message ID <differential-rev-PHID-DREV-uwemiksavixkw3j73hdl-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49524/
State Superseded
Headers show

Comments

phabricator - July 23, 2021, 7:17 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is slower, but probably doesn't matter?

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/fix.py
  tests/test-fix.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -370,7 +370,6 @@ 
   M hello.whole
   $ hg fix -s . *
   $ hg st
-  M hello.whole (known-bad-output !)
   $ hg diff
 
   $ cd ..
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -759,13 +759,12 @@ 
     for path, data in pycompat.iteritems(filedata):
         fctx = ctx[path]
         fctx.write(data, fctx.flags())
-        if repo.dirstate[path] == b'n':
-            repo.dirstate.set_possibly_dirty(path)
 
     oldp1 = repo.dirstate.p1()
     newp1 = replacements.get(oldp1, oldp1)
     if newp1 != oldp1:
-        repo.setparents(newp1, nullid)
+        with repo.dirstate.parentchange():
+            scmutil.movedirstate(repo, repo[newp1])
 
 
 def replacerev(ui, repo, ctx, filedata, replacements):