# HG changeset patch # User Pierre-Yves David # Date 2023-02-20 16:13:29 # Node ID b583988c6c233c7a05fdaecb17abf6131de46409 # Parent 0be70c7b609c4f5a5a37e9029cef9b9a23f3a3b9 dirstate: have `running_status` warn when exiting with a dirty dirstate If running_status was started without the lock, all changes should have been explicitly written (with the lock) or invalidated before exiting the context. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -267,6 +267,11 @@ class dirstate: if should_write: assert repo.currenttransaction() is tr self.write(tr) + elif not has_lock: + if self._dirty: + msg = b'dirstate dirty while exiting an isolated status context' + repo.ui.develwarn(msg) + self.invalidate() @contextlib.contextmanager @check_invalidated