[PATCH] merge: clarify error message when merging a branch with one head

Michael Tharp mtharp at rpath.com
Fri May 27 10:42:33 CDT 2011


# HG changeset patch
# User Michael Tharp <gxti at partiallystapled.com>
# Date 1306509586 14400
# Node ID 6c926d3cf64b5670f9c25e19042d930a031fe018
# Parent  61f51f4a9a3b2fd76786fe0db88c4a10298975ee
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")
                                  % 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


More information about the Mercurial-devel mailing list