changeset 50148:b583988c6c23

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 20 Feb 2023 17:13:29 +0100
parents 0be70c7b609c
children 03decaaf1eff
files mercurial/dirstate.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Feb 22 02:21:27 2023 +0100
+++ b/mercurial/dirstate.py	Mon Feb 20 17:13:29 2023 +0100
@@ -267,6 +267,11 @@
         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