Patchwork D8168: merge: introduce a merge() for that use-case

login
register
mail settings
Submitter phabricator
Date Feb. 27, 2020, 4:36 p.m.
Message ID <bfc2cd34baba090f8b4b6d5c6309cf5c@localhost.localdomain>
Download mbox | patch
Permalink /patch/45364/
State Not Applicable
Headers show

Comments

phabricator - Feb. 27, 2020, 4:36 p.m.
martinvonz marked an inline comment as done.
martinvonz updated this revision to Diff 20358.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8168?vs=20346&id=20358

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8168/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8168

AFFECTED FILES
  mercurial/hg.py
  mercurial/merge.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2597,6 +2597,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.
 
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -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(