changeset 15619:6c8573dd1b6b

merge: make 'nothing to merge' aborts consistent Makes the 'nothing to merge' abort messages in commands.py consistent with those in merge.py. Also makes commands.merge() and merge.update() use hints. The tests show the changes.
author Kevin Bullock <kbullock@ringworld.org>
date Wed, 07 Dec 2011 11:23:01 -0600
parents 0aca2695a110
children 73faa2664909
files mercurial/commands.py mercurial/merge.py tests/test-merge-default.t tests/test-merge-force.t tests/test-merge1.t tests/test-up-local-change.t
diffstat 6 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Dec 07 11:22:57 2011 -0600
+++ b/mercurial/commands.py	Wed Dec 07 11:23:01 2011 -0600
@@ -4042,10 +4042,10 @@
                                    "please merge with an explicit rev")
                                  % branch,
                                  hint=_("run 'hg heads' to see all heads"))
-            msg = _('there is nothing to merge')
+            msg, hint = _('nothing to merge'), None
             if parent != repo.lookup(branch):
-                msg = _('%s - use "hg update" instead') % msg
-            raise util.Abort(msg)
+                hint = _("use 'hg update' instead")
+            raise util.Abort(msg, hint=hint)
 
         if parent not in bheads:
             raise util.Abort(_('working directory not at a head revision'),
--- a/mercurial/merge.py	Wed Dec 07 11:22:57 2011 -0600
+++ b/mercurial/merge.py	Wed Dec 07 11:23:01 2011 -0600
@@ -519,11 +519,12 @@
                                    " has no effect"))
             elif pa == p1:
                 if p1.branch() == p2.branch():
-                    raise util.Abort(_("nothing to merge (use 'hg update'"
-                                       " or check 'hg heads')"))
+                    raise util.Abort(_("nothing to merge"),
+                                     hint=_("use 'hg update' "
+                                            "or check 'hg heads'"))
             if not force and (wc.files() or wc.deleted()):
-                raise util.Abort(_("outstanding uncommitted changes "
-                                   "(use 'hg status' to list changes)"))
+                raise util.Abort(_("outstanding uncommitted changes"),
+                                 hint=_("use 'hg status' to list changes"))
             for s in wc.substate:
                 if wc.sub(s).dirty():
                     raise util.Abort(_("outstanding uncommitted changes in "
--- a/tests/test-merge-default.t	Wed Dec 07 11:22:57 2011 -0600
+++ b/tests/test-merge-default.t	Wed Dec 07 11:23:01 2011 -0600
@@ -66,7 +66,7 @@
 Should fail because at tip:
 
   $ hg merge
-  abort: there is nothing to merge
+  abort: nothing to merge
   [255]
 
   $ hg up 0
@@ -75,7 +75,8 @@
 Should fail because there is only one head:
 
   $ hg merge
-  abort: there is nothing to merge - use "hg update" instead
+  abort: nothing to merge
+  (use 'hg update' instead)
   [255]
 
   $ hg up 3
--- a/tests/test-merge-force.t	Wed Dec 07 11:22:57 2011 -0600
+++ b/tests/test-merge-force.t	Wed Dec 07 11:23:01 2011 -0600
@@ -19,7 +19,8 @@
 Should fail, since there are deleted files:
 
   $ hg merge
-  abort: outstanding uncommitted changes (use 'hg status' to list changes)
+  abort: outstanding uncommitted changes
+  (use 'hg status' to list changes)
   [255]
 
 Should succeed with --force:
--- a/tests/test-merge1.t	Wed Dec 07 11:22:57 2011 -0600
+++ b/tests/test-merge1.t	Wed Dec 07 11:23:01 2011 -0600
@@ -108,7 +108,8 @@
   $ echo This is file b22 > b
 merge fails
   $ hg merge 2
-  abort: outstanding uncommitted changes (use 'hg status' to list changes)
+  abort: outstanding uncommitted changes
+  (use 'hg status' to list changes)
   [255]
 merge expected!
   $ hg merge -f 2
@@ -144,7 +145,8 @@
   $ echo This is file b33 > b
 merge of b should fail
   $ hg merge 2
-  abort: outstanding uncommitted changes (use 'hg status' to list changes)
+  abort: outstanding uncommitted changes
+  (use 'hg status' to list changes)
   [255]
 merge of b expected
   $ hg merge -f 2
--- a/tests/test-up-local-change.t	Wed Dec 07 11:22:57 2011 -0600
+++ b/tests/test-up-local-change.t	Wed Dec 07 11:23:01 2011 -0600
@@ -84,7 +84,8 @@
   summary:     1
   
   $ hg --debug merge
-  abort: there is nothing to merge - use "hg update" instead
+  abort: nothing to merge
+  (use 'hg update' instead)
   [255]
   $ hg parents
   changeset:   0:c19d34741b0a
@@ -169,7 +170,8 @@
   abort: crosses branches (merge branches or use --clean to discard changes)
   [255]
   $ hg --debug merge
-  abort: outstanding uncommitted changes (use 'hg status' to list changes)
+  abort: outstanding uncommitted changes
+  (use 'hg status' to list changes)
   [255]
   $ hg --debug merge -f
     searching for copies back to rev 1