diff hgext/mq.py @ 49961:7a8bfc05b691

dirstate: rename parentchange to changing_parents Since the new argument breaks the API anyway, we can rename it to a better name. The previous name `parentchange` might be seen as something active, a function that would directly change the parents, however this is just a context manager to frame the operation that will change the parents and adjust the dirstate content accordingly. In addition, the future sister method that will be about changes to tracking and files would have a hard time fitting in the same naming scheme in a clear way. The new naming uses a clear prefix will make it more distinct from other dirstate methods and easier to extend with other similar contexts.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Jan 2023 19:12:31 +0100
parents c166b212bdee
children 89796af68b27
line wrap: on
line diff
--- a/hgext/mq.py	Wed Jan 25 18:46:20 2023 +0100
+++ b/hgext/mq.py	Wed Jan 25 19:12:31 2023 +0100
@@ -1082,7 +1082,7 @@
 
             if merge and files:
                 # Mark as removed/merged and update dirstate parent info
-                with repo.dirstate.parentchange(repo):
+                with repo.dirstate.changing_parents(repo):
                     for f in files:
                         repo.dirstate.update_file_p1(f, p1_tracked=True)
                     p1 = repo.dirstate.p1()
@@ -1830,7 +1830,7 @@
                 if keepchanges and tobackup:
                     raise error.Abort(_(b"local changes found, qrefresh first"))
                 self.backup(repo, tobackup)
-                with repo.dirstate.parentchange(repo):
+                with repo.dirstate.changing_parents(repo):
                     for f in a:
                         repo.wvfs.unlinkpath(f, ignoremissing=True)
                         repo.dirstate.update_file(
@@ -1988,7 +1988,7 @@
 
             bmlist = repo[top].bookmarks()
 
-            with repo.dirstate.parentchange(repo):
+            with repo.dirstate.changing_parents(repo):
                 # XXX do we actually need the dirstateguard
                 dsguard = None
                 try: