diff mercurial/commands.py @ 45550:2b339c6c6e99

merge: add a back_out() function to encapsulate update() I've sent several earlier patches adding `merge.clean_update()`, `merge.merge()` etc, one function for each use case. This patch continues that work. I plan to hide the complex `update()` eventually. Differential Revision: https://phab.mercurial-scm.org/D9064
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 21 Sep 2020 09:56:48 -0700
parents 32ce4cbaec4b
children 03726f5b6092
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 18 17:19:49 2020 +0530
+++ b/mercurial/commands.py	Mon Sep 21 09:56:48 2020 -0700
@@ -790,7 +790,8 @@
 
     cmdutil.checkunfinished(repo)
     cmdutil.bailifchanged(repo)
-    node = scmutil.revsingle(repo, rev).node()
+    ctx = scmutil.revsingle(repo, rev)
+    node = ctx.node()
 
     op1, op2 = repo.dirstate.parents()
     if not repo.changelog.isancestor(node, op1):
@@ -821,14 +822,7 @@
         with dirstateguard.dirstateguard(repo, b'backout'):
             overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
             with ui.configoverride(overrides, b'backout'):
-                stats = mergemod.update(
-                    repo,
-                    parent,
-                    branchmerge=True,
-                    force=True,
-                    ancestor=node,
-                    mergeancestor=False,
-                )
+                stats = mergemod.back_out(ctx, parent=repo[parent])
             repo.setparents(op1, op2)
         hg._showstats(repo, stats)
         if stats.unresolvedcount: