D11178: keywork: use `update_file_p1` instead of `normallookup`
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Jul 19 14:11:07 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This is the newer, more semantic API.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11178
AFFECTED FILES
hgext/keyword.py
CHANGE DETAILS
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -358,7 +358,7 @@
if kwcmd:
self.repo.dirstate.set_clean(f)
elif self.postcommit:
- self.repo.dirstate.normallookup(f)
+ self.repo.dirstate.update_file_p1(f, p1_tracked=True)
def shrink(self, fname, text):
'''Returns text with all keyword substitutions removed.'''
@@ -691,7 +691,7 @@
kwt = getattr(repo, '_keywordkwt', None)
if kwt is None:
return orig(ui, repo, old, extra, pats, opts)
- with repo.wlock():
+ with repo.wlock(), repo.dirstate.parentchange():
kwt.postcommit = True
newid = orig(ui, repo, old, extra, pats, opts)
if newid != old.node():
@@ -757,8 +757,9 @@
if ctx != recctx:
modified, added = _preselect(wstatus, recctx.files())
kwt.restrict = False
- kwt.overwrite(recctx, modified, False, True)
- kwt.overwrite(recctx, added, False, True, True)
+ with repo.dirstate.parentchange():
+ kwt.overwrite(recctx, modified, False, True)
+ kwt.overwrite(recctx, added, False, True, True)
kwt.restrict = True
return ret
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list