D11210: fix: use scmutil.movedirstate() instead of reimplementing
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Jul 23 07:17:21 UTC 2021
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
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):
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list