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 ☺
--- 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.