mercurial/commands.py
changeset 14918 ebdfdba0faaf
parent 14907 84af56cc673b
parent 14903 a934b9249574
child 14943 d3bb825ddae3
--- a/mercurial/commands.py	Thu Jul 21 15:10:16 2011 +0200
+++ b/mercurial/commands.py	Fri Jul 22 17:17:23 2011 -0500
@@ -4156,9 +4156,11 @@
        To cancel a merge (and lose your changes), use :hg:`update --clean .`.
 
     With no revision specified, revert the specified files or directories
-    to the state they had in the first parent of the working directory.
+    to the contents they had in the parent of the working directory.
     This restores the contents of files to an unmodified
-    state and unschedules adds, removes, copies, and renames.
+    state and unschedules adds, removes, copies, and renames. If the
+    working directory has two parents, you must explicitly specify a
+    revision.
 
     Using the -r/--rev or -d/--date options, revert the given files or
     directories to their states as of a specific revision. Because
@@ -4181,6 +4183,11 @@
         opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
 
     parent, p2 = repo.dirstate.parents()
+    if not opts.get('rev') and p2 != nullid:
+        # revert after merge is a trap for new users (issue2915)
+        raise util.Abort(_('uncommitted merge with no revision specified'),
+                         hint=_('use "hg update" or see "hg help revert"'))
+
     ctx = scmutil.revsingle(repo, opts.get('rev'))
     node = ctx.node()