diff mercurial/cmdutil.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 a46dfc2b58a3
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Jan 25 18:46:20 2023 +0100
+++ b/mercurial/cmdutil.py	Wed Jan 25 19:12:31 2023 +0100
@@ -638,7 +638,7 @@
                         # already called within a `pendingchange`, However we
                         # are taking a shortcut here in order to be able to
                         # quickly deprecated the older API.
-                        with dirstate.parentchange(repo):
+                        with dirstate.changing_parents(repo):
                             dirstate.update_file(
                                 realname,
                                 p1_tracked=True,
@@ -1532,7 +1532,7 @@
                 new_node = mem_ctx.commit()
 
                 if repo.dirstate.p1() == ctx.node():
-                    with repo.dirstate.parentchange(repo):
+                    with repo.dirstate.changing_parents(repo):
                         scmutil.movedirstate(repo, repo[new_node])
                 replacements = {ctx.node(): [new_node]}
                 scmutil.cleanupnodes(
@@ -1625,7 +1625,7 @@
             new_node = mem_ctx.commit()
 
             if repo.dirstate.p1() == ctx.node():
-                with repo.dirstate.parentchange(repo):
+                with repo.dirstate.changing_parents(repo):
                     scmutil.movedirstate(repo, repo[new_node])
             replacements = {ctx.node(): [new_node]}
             scmutil.cleanupnodes(repo, replacements, b'copy', fixphase=True)
@@ -3024,7 +3024,7 @@
         newid = repo.commitctx(new)
         ms.reset()
 
-        with repo.dirstate.parentchange(repo):
+        with repo.dirstate.changing_parents(repo):
             # Reroute the working copy parent to the new changeset
             repo.setparents(newid, repo.nullid)