Mercurial > hg
changeset 11353:f2b25e8ea6c1
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.
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Mon, 14 Jun 2010 16:06:52 -0400 |
parents | b19067ee4507 |
children | 412a6e749f8d |
files | mercurial/commands.py |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Jun 15 16:10:32 2010 -0400 +++ b/mercurial/commands.py Mon Jun 14 16:06:52 2010 -0400 @@ -2561,19 +2561,20 @@ 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