revert: improve merge advice and favor its error over all
authortimeless <timeless@gmail.com>
Sat, 20 Nov 2010 20:41:48 +0200
changeset 13022 3fd4e4e81382
parent 13019 42ac864ed394
child 13023 3e2281b85990
revert: improve merge advice and favor its error over all
mercurial/commands.py
tests/test-confused-revert.t
--- a/mercurial/commands.py	Wed Nov 17 16:54:30 2010 +0100
+++ b/mercurial/commands.py	Sat Nov 20 20:41:48 2010 +0200
@@ -3105,14 +3105,15 @@
             raise util.Abort(_("you can't specify a revision and a date"))
         opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
 
+    parent, p2 = repo.dirstate.parents()
+    if not opts.get('rev') and p2 != nullid:
+        raise util.Abort(_('uncommitted merge - '
+                           'use "hg update", see "hg help revert"'))
+
     if not pats and not opts.get('all'):
         raise util.Abort(_('no files or directories specified; '
                            'use --all to revert the whole repo'))
 
-    parent, p2 = repo.dirstate.parents()
-    if not opts.get('rev') and p2 != nullid:
-        raise util.Abort(_('uncommitted merge - please provide a '
-                           'specific revision'))
     ctx = cmdutil.revsingle(repo, opts.get('rev'))
     node = ctx.node()
     mf = ctx.manifest()
--- a/tests/test-confused-revert.t	Wed Nov 17 16:54:30 2010 +0100
+++ b/tests/test-confused-revert.t	Sat Nov 20 20:41:48 2010 +0200
@@ -58,8 +58,8 @@
 
 Revert should fail:
 
-  $ hg revert --all
-  abort: uncommitted merge - please provide a specific revision
+  $ hg revert
+  abort: uncommitted merge - use "hg update", see "hg help revert"
   [255]
 
 Revert should be ok now: