changeset 44430:a45ffad9ae98

merge: introduce a merge() for that use-case In the same vein as some earlier patches like f546d2170b0f (merge: introduce a clean_update() for that use-case, 2020-01-15). Differential Revision: https://phab.mercurial-scm.org/D8168
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 26 Feb 2020 10:40:31 -0800
parents ddbc296a1f48
children 0e5e192adb6f
files mercurial/hg.py mercurial/merge.py
diffstat 2 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Wed Feb 26 11:00:50 2020 -0800
+++ b/mercurial/hg.py	Wed Feb 26 10:40:31 2020 -0800
@@ -1141,14 +1141,7 @@
 ):
     """Branch merge with node, resolving changes. Return true if any
     unresolved conflicts."""
-    stats = mergemod.update(
-        repo,
-        node,
-        branchmerge=True,
-        force=force,
-        mergeforce=force,
-        labels=labels,
-    )
+    stats = mergemod.merge(repo[node], force=force, labels=labels)
     _showstats(repo, stats)
     if stats.unresolvedcount:
         repo.ui.status(
--- a/mercurial/merge.py	Wed Feb 26 11:00:50 2020 -0800
+++ b/mercurial/merge.py	Wed Feb 26 10:40:31 2020 -0800
@@ -2590,6 +2590,23 @@
     return stats
 
 
+def merge(ctx, labels=None, force=False, wc=None):
+    """Merge another topological branch into the working copy.
+
+    force = whether the merge was run with 'merge --force' (deprecated)
+    """
+
+    return update(
+        ctx.repo(),
+        ctx.rev(),
+        labels=labels,
+        branchmerge=True,
+        force=force,
+        mergeforce=force,
+        wc=wc,
+    )
+
+
 def clean_update(ctx, wc=None):
     """Do a clean update to the given commit.