mercurial/commands.py
changeset 14918 ebdfdba0faaf
parent 14907 84af56cc673b
parent 14903 a934b9249574
child 14943 d3bb825ddae3
equal deleted inserted replaced
14913:44382887d012 14918:ebdfdba0faaf
  4154     .. note::
  4154     .. note::
  4155        To check out earlier revisions, you should use :hg:`update REV`.
  4155        To check out earlier revisions, you should use :hg:`update REV`.
  4156        To cancel a merge (and lose your changes), use :hg:`update --clean .`.
  4156        To cancel a merge (and lose your changes), use :hg:`update --clean .`.
  4157 
  4157 
  4158     With no revision specified, revert the specified files or directories
  4158     With no revision specified, revert the specified files or directories
  4159     to the state they had in the first parent of the working directory.
  4159     to the contents they had in the parent of the working directory.
  4160     This restores the contents of files to an unmodified
  4160     This restores the contents of files to an unmodified
  4161     state and unschedules adds, removes, copies, and renames.
  4161     state and unschedules adds, removes, copies, and renames. If the
       
  4162     working directory has two parents, you must explicitly specify a
       
  4163     revision.
  4162 
  4164 
  4163     Using the -r/--rev or -d/--date options, revert the given files or
  4165     Using the -r/--rev or -d/--date options, revert the given files or
  4164     directories to their states as of a specific revision. Because
  4166     directories to their states as of a specific revision. Because
  4165     revert does not change the working directory parents, this will
  4167     revert does not change the working directory parents, this will
  4166     cause these files to appear modified. This can be helpful to "back
  4168     cause these files to appear modified. This can be helpful to "back
  4179         if opts.get("rev"):
  4181         if opts.get("rev"):
  4180             raise util.Abort(_("you can't specify a revision and a date"))
  4182             raise util.Abort(_("you can't specify a revision and a date"))
  4181         opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
  4183         opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
  4182 
  4184 
  4183     parent, p2 = repo.dirstate.parents()
  4185     parent, p2 = repo.dirstate.parents()
       
  4186     if not opts.get('rev') and p2 != nullid:
       
  4187         # revert after merge is a trap for new users (issue2915)
       
  4188         raise util.Abort(_('uncommitted merge with no revision specified'),
       
  4189                          hint=_('use "hg update" or see "hg help revert"'))
       
  4190 
  4184     ctx = scmutil.revsingle(repo, opts.get('rev'))
  4191     ctx = scmutil.revsingle(repo, opts.get('rev'))
  4185     node = ctx.node()
  4192     node = ctx.node()
  4186 
  4193 
  4187     if not pats and not opts.get('all'):
  4194     if not pats and not opts.get('all'):
  4188         msg = _("no files or directories specified")
  4195         msg = _("no files or directories specified")