changeset 50150:b09a0afcb975

keyword: wrap dirstate mutation in `changing_files` context This is the way.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 22 Feb 2023 03:34:48 +0100
parents 03decaaf1eff
children 092db6464321
files hgext/keyword.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Tue Feb 21 23:10:02 2023 +0100
+++ b/hgext/keyword.py	Wed Feb 22 03:34:48 2023 +0100
@@ -437,12 +437,11 @@
     if len(wctx.parents()) > 1:
         raise error.Abort(_(b'outstanding uncommitted merge'))
     kwt = getattr(repo, '_keywordkwt', None)
-    with repo.wlock():
+    with repo.wlock(), repo.dirstate.changing_files(repo):
         status = _status(ui, repo, wctx, kwt, *pats, **opts)
         if status.modified or status.added or status.removed or status.deleted:
             raise error.Abort(_(b'outstanding uncommitted changes'))
         kwt.overwrite(wctx, status.clean, True, expand)
-        repo.dirstate.write(repo.currenttransaction())
 
 
 @command(