Mercurial > public > mercurial-scm > hg
diff mercurial/dirstate.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 | f92afdf3cff9 |
children | c5e93c915ab6 |
line wrap: on
line diff
--- 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():