# HG changeset patch # User Pierre-Yves David # Date 1676997823 -3600 # Node ID 15531d1013137c55fa47efcd25ce42297697390c # Parent a7d11833ff48a94d9c7abaf97d5eb47de633d0a2 dirstate: add small asserts for double security We don't need this, but it does not hurt. diff -r a7d11833ff48 -r 15531d101313 mercurial/dirstate.py --- 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()):