[PATCH] cleanup: pass in overwrite flag to hg.updaterepo() as named argument

Yuya Nishihara yuya at tcha.org
Sun Jul 1 14:09:48 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1530448855 -32400
#      Sun Jul 01 21:40:55 2018 +0900
# Node ID 39db5a01cd53349418f75f7218e60515a9fe67dd
# Parent  03e7ec8180f02879bd2a7bcc75f2807d191f3f66
cleanup: pass in overwrite flag to hg.updaterepo() as named argument

For clarity.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -784,7 +784,7 @@ class fold(histeditaction):
 
     def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
         parent = ctx.parents()[0].node()
-        hg.updaterepo(repo, parent, False)
+        hg.updaterepo(repo, parent, overwrite=False)
         ### prepare new commit data
         commitopts = {}
         commitopts['user'] = ctx.user()
@@ -815,7 +815,7 @@ class fold(histeditaction):
                          skipprompt=self.skipprompt())
         if n is None:
             return ctx, []
-        hg.updaterepo(repo, n, False)
+        hg.updaterepo(repo, n, overwrite=False)
         replacements = [(oldctx.node(), (newnode,)),
                         (ctx.node(), (n,)),
                         (newnode, (n,)),
@@ -1177,7 +1177,7 @@ def _continuehistedit(ui, repo, state):
 
 def _finishhistedit(ui, repo, state, fm):
     """This action runs when histedit is finishing its session"""
-    hg.updaterepo(repo, state.parentctxnode, False)
+    hg.updaterepo(repo, state.parentctxnode, overwrite=False)
 
     mapping, tmpnodes, created, ntm = processreplacement(state)
     if mapping:
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -623,7 +623,7 @@ class rebaseruntime(object):
             newwd = self.originalwd
         if newwd not in [c.rev() for c in repo[None].parents()]:
             ui.note(_("update back to initial working directory parent\n"))
-            hg.updaterepo(repo, newwd, False)
+            hg.updaterepo(repo, newwd, overwrite=False)
 
         collapsedas = None
         if self.collapsef and not self.keepf:
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -709,7 +709,7 @@ def unshelvecontinue(ui, repo, state, op
             state.nodestoremove.append(newnode)
             shelvectx = repo[newnode]
 
-        hg.updaterepo(repo, pendingctx.node(), False)
+        hg.updaterepo(repo, pendingctx.node(), overwrite=False)
 
         if repo.vfs.exists('unshelverebasestate'):
             repo.vfs.rename('unshelverebasestate', 'rebasestate')
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2451,7 +2451,7 @@ def _abortgraft(ui, repo, graftstate):
 
         if cleanup:
             with repo.wlock(), repo.lock():
-                hg.updaterepo(repo, startctx.node(), True)
+                hg.updaterepo(repo, startctx.node(), overwrite=True)
                 # stripping the new nodes created
                 strippoints = [c.node() for c in repo.set("roots(%ld)",
                                                           newnodes)]
@@ -2460,7 +2460,7 @@ def _abortgraft(ui, repo, graftstate):
     if not cleanup:
         # we don't update to the startnode if we can't strip
         startctx = repo['.']
-        hg.updaterepo(repo, startctx.node(), True)
+        hg.updaterepo(repo, startctx.node(), overwrite=True)
 
     ui.status(_("graft aborted\n"))
     ui.status(_("working directory is now at %s\n") % startctx.hex()[:12])
@@ -2480,7 +2480,7 @@ def _stopgraft(ui, repo, graftstate):
     if not graftstate.exists():
         raise error.Abort(_("no interrupted graft found"))
     pctx = repo['.']
-    hg.updaterepo(repo, pctx.node(), True)
+    hg.updaterepo(repo, pctx.node(), overwrite=True)
     graftstate.delete()
     ui.status(_("stopped the interrupted graft\n"))
     ui.status(_("working directory is now at %s\n") % pctx.hex()[:12])


More information about the Mercurial-devel mailing list