##// END OF EJS Templates
revert: restore check for uncommitted merge (issue2915) (BC)...
Matt Mackall -
r14903:a934b924 stable
parent child Browse files
Show More
@@ -4154,9 +4154,11 b' def revert(ui, repo, *pats, **opts):'
4154 To cancel a merge (and lose your changes), use :hg:`update --clean .`.
4154 To cancel a merge (and lose your changes), use :hg:`update --clean .`.
4155
4155
4156 With no revision specified, revert the specified files or directories
4156 With no revision specified, revert the specified files or directories
4157 to the state they had in the first parent of the working directory.
4157 to the contents they had in the parent of the working directory.
4158 This restores the contents of files to an unmodified
4158 This restores the contents of files to an unmodified
4159 state and unschedules adds, removes, copies, and renames.
4159 state and unschedules adds, removes, copies, and renames. If the
4160 working directory has two parents, you must explicitly specify a
4161 revision.
4160
4162
4161 Using the -r/--rev or -d/--date options, revert the given files or
4163 Using the -r/--rev or -d/--date options, revert the given files or
4162 directories to their states as of a specific revision. Because
4164 directories to their states as of a specific revision. Because
@@ -4179,6 +4181,11 b' def revert(ui, repo, *pats, **opts):'
4179 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
4181 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
4180
4182
4181 parent, p2 = repo.dirstate.parents()
4183 parent, p2 = repo.dirstate.parents()
4184 if not opts.get('rev') and p2 != nullid:
4185 # revert after merge is a trap for new users (issue2915)
4186 raise util.Abort(_('uncommitted merge with no revision specified'),
4187 hint=_('use "hg update" or see "hg help revert"'))
4188
4182 ctx = scmutil.revsingle(repo, opts.get('rev'))
4189 ctx = scmutil.revsingle(repo, opts.get('rev'))
4183 node = ctx.node()
4190 node = ctx.node()
4184
4191
@@ -59,8 +59,8 b' Should show a removed and b added:'
59 Revert should fail:
59 Revert should fail:
60
60
61 $ hg revert
61 $ hg revert
62 abort: no files or directories specified
62 abort: uncommitted merge with no revision specified
63 (uncommitted merge, use --all to discard all changes, or 'hg update -C .' to abort the merge)
63 (use "hg update" or see "hg help revert")
64 [255]
64 [255]
65
65
66 Revert should be ok now:
66 Revert should be ok now:
General Comments 0
You need to be logged in to leave comments. Login now