# HG changeset patch # User Pierre-Yves David # Date 2023-02-18 03:10:08 # Node ID cdbd5f99059672d19c1d7a469e0cd96d4eab2ca2 # Parent 2323b74f927b7fe2f68c949579076bc3cc80e654 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 ☺ diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -479,9 +479,7 @@ class dirstate: 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.