Patchwork D11178: keywork: use `update_file_p1` instead of `normallookup`

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 2:11 p.m.
Message ID <differential-rev-PHID-DREV-dk76dai3pwhatzpvdxw7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49490/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 2:11 p.m.
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




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

Patch

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