[PATCH] merge: when current branch has 1 or > 2 heads, actually abort
mpm at selenic.com
Mon Jun 14 14:27:06 CDT 2010
On Mon, 2010-06-14 at 15:02 -0400, Greg Ward wrote:
> # HG changeset patch
> # User Greg Ward <greg-hg at gerg.ca>
> # Date 1276541492 14400
> # Node ID a6348965cf51fe962f2395c6bc7b72646c0a40ab
> # Parent c6971a790206f824df9b25607fa4d030baad92fd
> 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 @@
> 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 %s" to see all branch heads)')
> + % (branch, len(bheads), branch))
When you make a change like this, please don't introduce any other
unrelated changes (however trivial). First, it just makes more confusion
for reviewers. Second, it might turn out that the unrelated changes
aren't appreciated. For instance, I actually don't like the addition of
the double dash in the message. And I didn't realize until my third pass
over it that you'd also added something about heads -t, which is maybe
not the right thing to do.
Please send a new patch with just the obviously correct change described
in the description.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel