# HG changeset patch # User Greg Ward # Date 2010-06-14 20:06:52 # Node ID f2b25e8ea6c1b80bce3a905ce0ba3ea04439dc96 # Parent b19067ee45077aaa24bf1569ddeffe84eb521bc8 merge: when current branch has 1 or > 2 heads, actually abort. Currently merge just prints abort-like messages to stderr and then exits with a misleading status 0 (cleverly disguised as "False"). With this change it raises Abort, just like every other fatal error. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2561,19 +2561,20 @@ def merge(ui, repo, node=None, **opts): branch = repo.changectx(None).branch() bheads = repo.branchheads(branch) if len(bheads) > 2: - ui.warn(_("abort: branch '%s' has %d heads - " - "please merge with an explicit rev\n") - % (branch, len(bheads))) - ui.status(_("(run 'hg heads .' to see heads)\n")) - return False + raise util.Abort(_( + 'branch \'%s\' has %d heads - ' + 'please merge with an explicit rev\n' + '(run \'hg heads .\' to see heads)') + % (branch, len(bheads))) parent = repo.dirstate.parents()[0] if len(bheads) == 1: if len(repo.heads()) > 1: - ui.warn(_("abort: branch '%s' has one head - " - "please merge with an explicit rev\n" % branch)) - ui.status(_("(run 'hg heads' to see all heads)\n")) - return False + raise util.Abort(_( + 'branch \'%s\' has one head - ' + 'please merge with an explicit rev\n' + '(run \'hg heads\' to see all heads)') + % branch) msg = _('there is nothing to merge') if parent != repo.lookup(repo[None].branch()): msg = _('%s - use "hg update" instead') % msg