--- a/mercurial/dirstate.py Tue Mar 14 14:08:38 2023 +0000
+++ b/mercurial/dirstate.py Wed Mar 15 05:49:56 2023 +0100
@@ -200,6 +200,12 @@
self._cwd
def refresh(self):
+ # XXX if this happens, you likely did not enter the `changing_xxx`
+ # using `repo.dirstate`, so a later `repo.dirstate` accesss might call
+ # `refresh`.
+ if self.is_changing_any:
+ msg = "refreshing the dirstate in the middle of a change"
+ raise error.ProgrammingError(msg)
if '_branch' in vars(self):
del self._branch
if '_map' in vars(self) and self._map.may_need_refresh():