[PATCH RESEND] merge: clarify error message when merging a branch with one head
Matt Mackall
mpm at selenic.com
Tue May 31 17:09:27 CDT 2011
On Tue, 2011-05-31 at 15:04 -0400, Michael Tharp wrote:
> # HG changeset patch
> # User Michael Tharp <gxti at partiallystapled.com>
> # Date 1306509586 14400
> # Node ID 93df25a7776ceccc58a6925b4a042e9ad7c10fb8
> # Parent d1a1578c5f7860b17f2f238b2c1e6adb555ffa4f
> merge: clarify error message when merging a branch with one head
>
> Previously the error said only that there was one head, which is not
> consistent with the error displayed on on a repository with no branches.
> Now the key phrase "nothing to merge" appears in both cases.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3498,8 +3498,8 @@
> parent = repo.dirstate.p1()
> if len(bheads) == 1:
> if len(repo.heads()) > 1:
> - raise util.Abort(_("branch '%s' has one head - "
> - "please merge with an explicit rev")
> + raise util.Abort(_("there is nothing to merge on branch '%s' - "
> + "please specify a branch or revision to merge")
Was waiting for other folks to bikeshed this, but here are my thoughts:
Looks like this fails to actually achieve stylistic consistency with the
message in merge.py:
raise util.Abort(_("nothing to merge (use 'hg update'"
" or check 'hg heads')"))
The preferred style is in fact:
abort: brief message (brief hint)
So I think we should aim for something like:
raise util.Abort(_("nothing to merge on branch '%s'" % branch),
hint=_("specify a branch or revision to merge"))
Note the use of hint and the additional brevity.
> % branch,
> hint=_("run 'hg heads' to see all heads"))
> msg = _('there is nothing to merge')
> diff --git a/tests/test-merge-default.t b/tests/test-merge-default.t
> --- a/tests/test-merge-default.t
> +++ b/tests/test-merge-default.t
> @@ -89,7 +89,7 @@
> Should fail because merge with other branch:
>
> $ hg merge
> - abort: branch 'foobranch' has one head - please merge with an explicit rev
> + abort: there is nothing to merge on branch 'foobranch' - please specify a branch or revision to merge
> (run 'hg heads' to see all heads)
> [255]
>
> diff --git a/tests/test-newbranch.t b/tests/test-newbranch.t
> --- a/tests/test-newbranch.t
> +++ b/tests/test-newbranch.t
> @@ -294,7 +294,7 @@
> Implicit merge with test branch as parent:
>
> $ hg merge
> - abort: branch 'test' has one head - please merge with an explicit rev
> + abort: there is nothing to merge on branch 'test' - please specify a branch or revision to merge
> (run 'hg heads' to see all heads)
> [255]
> $ hg up -C default
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list