mercurial/commands.py
branchstable
changeset 14726 e0039716f3ea
parent 14725 2852933fc942
child 14729 94eea58da2a3
--- a/mercurial/commands.py	Fri Jun 24 10:51:05 2011 +0200
+++ b/mercurial/commands.py	Fri Jun 24 12:37:29 2011 +0200
@@ -4179,6 +4179,8 @@
         opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
 
     parent, p2 = repo.dirstate.parents()
+    ctx = scmutil.revsingle(repo, opts.get('rev'))
+    node = ctx.node()
 
     if not pats and not opts.get('all'):
         msg = _("no files or directories specified")
@@ -4186,10 +4188,15 @@
         if p2 != nullid:
             hint = _("uncommitted merge, use --all to discard all changes,"
                      " or 'hg update -C .' to abort the merge")
+        elif node != parent:
+            if util.any(repo.status()):
+                hint = _("uncommitted changes, use --all to discard all"
+                         " changes, or 'hg update %s' to update") % ctx.rev()
+            else:
+                hint = _("use --all to revert all files,"
+                         " or 'hg update %s' to update") % ctx.rev()
         raise util.Abort(msg, hint=hint)
 
-    ctx = scmutil.revsingle(repo, opts.get('rev'))
-    node = ctx.node()
     mf = ctx.manifest()
     if node == parent:
         pmf = mf