changeset 50106:cdbd5f990596

dirstate: requires being in a `changing_parents` `context to set_parents` Enforcing proper operation scoping on all methods that mutate the dirstate will tighten correctness and reduce the risk of bugs. The context to use for this method is obvious, and all code was already compliant ☺
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 18 Feb 2023 04:10:08 +0100
parents 2323b74f927b
children cad3a68c0e0c
files mercurial/dirstate.py
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Feb 21 00:10:20 2023 +0100
+++ b/mercurial/dirstate.py	Sat Feb 18 04:10:08 2023 +0100
@@ -479,9 +479,7 @@
     def branch(self):
         return encoding.tolocal(self._branch)
 
-    # 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_parents
     def setparents(self, p1, p2=None):
         """Set dirstate parents to p1 and p2.