diff mercurial/cmdutil.py @ 45562:03726f5b6092

merge: use merge.clean_update() when applicable We have had this higher-level function (higher than `merge.update()`, that is) for a while. Let's simply some callers by using it. I don't know why I didn't do this when I introduced the function. After this patch, there are no remaining callers that call `hg.updaterepo()` with `overwrite=True`. We'll clean that up soon. Differential Revision: https://phab.mercurial-scm.org/D9063
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 21 Sep 2020 10:09:39 -0700
parents 10284ce3d5ed
children 3a024d7cd08e
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Sep 18 15:03:06 2020 -0700
+++ b/mercurial/cmdutil.py	Mon Sep 21 10:09:39 2020 -0700
@@ -4154,7 +4154,6 @@
         startctx = repo[b'.']
     # whether to strip or not
     cleanup = False
-    from . import hg
 
     if newnodes:
         newnodes = [repo[r].rev() for r in newnodes]
@@ -4182,7 +4181,7 @@
 
         if cleanup:
             with repo.wlock(), repo.lock():
-                hg.updaterepo(repo, startctx.node(), overwrite=True)
+                mergemod.clean_update(startctx)
                 # stripping the new nodes created
                 strippoints = [
                     c.node() for c in repo.set(b"roots(%ld)", newnodes)
@@ -4192,7 +4191,7 @@
     if not cleanup:
         # we don't update to the startnode if we can't strip
         startctx = repo[b'.']
-        hg.updaterepo(repo, startctx.node(), overwrite=True)
+        mergemod.clean_update(startctx)
 
     ui.status(_(b"graft aborted\n"))
     ui.status(_(b"working directory is now at %s\n") % startctx.hex()[:12])