dirstate: mark the `copy` method as requiring a `changing_any` context
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 20 Feb 2023 11:57:46 +0100
changeset 50109 bec7182cc406
parent 50108 f7981f202b7a
child 50110 a860298776f0
dirstate: mark the `copy` method as requiring a `changing_any` context This is used both when changing parents (e.g. merging with rename) and changing files (e.g. running `hg rename`).
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Mon Feb 20 11:54:10 2023 +0100
+++ b/mercurial/dirstate.py	Mon Feb 20 11:57:46 2023 +0100
@@ -551,9 +551,7 @@
         self._invalidated_context = self._changing_level > 0
         self._origpl = None
 
-    # XXX since this make the dirstate dirty, 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)
+    @requires_changing_any
     def copy(self, source, dest):
         """Mark dest as a copy of source. Unmark dest if source is None."""
         if source == dest: