diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4909,9 +4909,7 @@ with ui.configoverride(overrides, b'merge'): force = opts.get(b'force') labels = [b'working copy', b'merge rev'] - return hg.merge( - repo, node, force=force, labels=labels - ) + return hg.merge(repo, node, force=force, labels=labels) statemod.addunfinished( 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( 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.