mercurial/dirstate.py
changeset 50117 3433723d1b9b
parent 50115 62f633f751a4
child 50118 65943224c184
--- a/mercurial/dirstate.py	Tue Feb 21 03:22:51 2023 +0100
+++ b/mercurial/dirstate.py	Sun Feb 19 03:21:12 2023 +0100
@@ -190,6 +190,9 @@
             raise error.ProgrammingError(msg)
 
         has_tr = repo.currenttransaction() is not None
+        if not has_tr and self._changing_level == 0 and self._dirty:
+            msg = "entering a changing context, but dirstate is already dirty"
+            raise error.ProgrammingError(msg)
 
         # different type of change are mutually exclusive
         if self._change_type is None: