Mercurial > hg
diff mercurial/dirstate.py @ 50121:15531d101313
dirstate: add small asserts for double security
We don't need this, but it does not hurt.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 21 Feb 2023 17:43:43 +0100 |
parents | a7d11833ff48 |
children | 72b4d9284411 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Feb 20 15:58:17 2023 +0100 +++ b/mercurial/dirstate.py Tue Feb 21 17:43:43 2023 +0100 @@ -935,6 +935,9 @@ def write(self, tr): if not self._dirty: return + # make sure we don't request a write of invalidated content + # XXX move before the dirty check once `unlock` stop calling `write` + assert not self._invalidated_context write_key = self._use_tracked_hint and self._dirty_tracked_set if tr: @@ -990,6 +993,8 @@ self._plchangecallbacks[category] = callback def _writedirstate(self, tr, st): + # make sure we don't write invalidated content + assert not self._invalidated_context # notify callbacks about parents change if self._origpl is not None and self._origpl != self._pl: for c, callback in sorted(self._plchangecallbacks.items()):