# HG changeset patch # User Martin von Zweigbergk # Date 2020-02-26 18:40:31 # Node ID a45ffad9ae98d545ba8f68e019511de2be6abaf6 # Parent ddbc296a1f48b963fa4aafdb22772e72583d8f28 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 diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1141,14 +1141,7 @@ def merge( ): """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( diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -2590,6 +2590,23 @@ def update( 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.