diff mercurial/commands.py @ 50301:9fc0d244a753 stable

dirstate: fix a potential traceback when in `copy` and `rename` Before this changes, calling `hg copy` or `hg rename` could trigger a traceback about using an invalidated dirstate. This wasn't caught by the test as it needed the blackbox extension to preload the dirstate first in a way "refresh" invalidates it. Changing the context creation patterns fixes it.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Mar 2023 05:49:56 +0100
parents e27a5a012323
children 80784ac09460 c5e93c915ab6
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Mar 14 14:08:38 2023 +0000
+++ b/mercurial/commands.py	Wed Mar 15 05:49:56 2023 +0100
@@ -2498,7 +2498,7 @@
     """
     opts = pycompat.byteskwargs(opts)
 
-    context = repo.dirstate.changing_files
+    context = lambda repo: repo.dirstate.changing_files(repo)
     rev = opts.get(b'at_rev')
     ctx = None
     if rev:
@@ -6012,7 +6012,7 @@
     Returns 0 on success, 1 if errors are encountered.
     """
     opts = pycompat.byteskwargs(opts)
-    context = repo.dirstate.changing_files
+    context = lambda repo: repo.dirstate.changing_files(repo)
     rev = opts.get(b'at_rev')
     ctx = None
     if rev: