##// END OF EJS Templates
revert: drop requirement to use -r to revert with two parents...
Matt Mackall -
r14542:afe0d4c2 default
parent child Browse files
Show More
@@ -4093,11 +4093,9 b' def revert(ui, repo, *pats, **opts):'
4093 To cancel a merge (and lose your changes), use :hg:`update --clean .`.
4093 To cancel a merge (and lose your changes), use :hg:`update --clean .`.
4094
4094
4095 With no revision specified, revert the named files or directories
4095 With no revision specified, revert the named files or directories
4096 to the contents they had in the parent of the working directory.
4096 to the contents they had in the first parent of the working directory.
4097 This restores the contents of the affected files to an unmodified
4097 This restores the contents of the affected files to an unmodified
4098 state and unschedules adds, removes, copies, and renames. If the
4098 state and unschedules adds, removes, copies, and renames.
4099 working directory has two parents, you must explicitly specify a
4100 revision.
4101
4099
4102 Using the -r/--rev option, revert the given files or directories
4100 Using the -r/--rev option, revert the given files or directories
4103 to their contents as of a specific revision. This can be helpful
4101 to their contents as of a specific revision. This can be helpful
@@ -4129,13 +4127,10 b' def revert(ui, repo, *pats, **opts):'
4129 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
4127 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
4130
4128
4131 parent, p2 = repo.dirstate.parents()
4129 parent, p2 = repo.dirstate.parents()
4132 if not opts.get('rev') and p2 != nullid:
4133 raise util.Abort(_('uncommitted merge - '
4134 'use "hg update", see "hg help revert"'))
4135
4130
4136 if not pats and not opts.get('all'):
4131 if not pats and not opts.get('all'):
4137 raise util.Abort(_('no files or directories specified; '
4132 raise util.Abort(_('no files or directories specified'),
4138 'use --all to revert the whole repo'))
4133 hint=_('use --all to revert all files'))
4139
4134
4140 ctx = scmutil.revsingle(repo, opts.get('rev'))
4135 ctx = scmutil.revsingle(repo, opts.get('rev'))
4141 node = ctx.node()
4136 node = ctx.node()
@@ -59,7 +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: uncommitted merge - use "hg update", see "hg help revert"
62 abort: no files or directories specified
63 (use --all to revert all files)
63 [255]
64 [255]
64
65
65 Revert should be ok now:
66 Revert should be ok now:
@@ -185,7 +185,8 b' Issue241: update and revert produces inc'
185 should fail - no arguments
185 should fail - no arguments
186
186
187 $ hg revert -rtip
187 $ hg revert -rtip
188 abort: no files or directories specified; use --all to revert the whole repo
188 abort: no files or directories specified
189 (use --all to revert all files)
189 [255]
190 [255]
190
191
191 should succeed
192 should succeed
General Comments 0
You need to be logged in to leave comments. Login now