changeset 50149:03decaaf1eff

dirstate: enforce `running_status` context for calling `status` Now that the context is working as intended and that the callers are updated. We can enforce it.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 21 Feb 2023 23:10:02 +0100
parents b583988c6c23
children b09a0afcb975
files mercurial/dirstate.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Mon Feb 20 17:13:29 2023 +0100
+++ b/mercurial/dirstate.py	Tue Feb 21 23:10:02 2023 +0100
@@ -1554,9 +1554,6 @@
         )
         return (lookup, status)
 
-    # XXX since this can make the dirstate dirty (through rust), we should
-    # enforce that it is done withing an appropriate change-context that scope
-    # the change and ensure it eventually get written on disk (or rolled back)
     def status(self, match, subrepos, ignored, clean, unknown):
         """Determine the status of the working copy relative to the
         dirstate and return a pair of (unsure, status), where status is of type
@@ -1573,6 +1570,9 @@
             files that have definitely not been modified since the
             dirstate was written
         """
+        if not self._running_status:
+            msg = "Calling `status` outside a `running_status` context"
+            raise error.ProgrammingError(msg)
         listignored, listclean, listunknown = ignored, clean, unknown
         lookup, modified, added, unknown, ignored = [], [], [], [], []
         removed, deleted, clean = [], [], []