Show More
@@ -4179,6 +4179,8 b' def revert(ui, repo, *pats, **opts):' | |||||
4179 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) |
|
4179 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) | |
4180 |
|
4180 | |||
4181 | parent, p2 = repo.dirstate.parents() |
|
4181 | parent, p2 = repo.dirstate.parents() | |
|
4182 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |||
|
4183 | node = ctx.node() | |||
4182 |
|
4184 | |||
4183 | if not pats and not opts.get('all'): |
|
4185 | if not pats and not opts.get('all'): | |
4184 | msg = _("no files or directories specified") |
|
4186 | msg = _("no files or directories specified") | |
@@ -4186,10 +4188,15 b' def revert(ui, repo, *pats, **opts):' | |||||
4186 | if p2 != nullid: |
|
4188 | if p2 != nullid: | |
4187 | hint = _("uncommitted merge, use --all to discard all changes," |
|
4189 | hint = _("uncommitted merge, use --all to discard all changes," | |
4188 | " or 'hg update -C .' to abort the merge") |
|
4190 | " or 'hg update -C .' to abort the merge") | |
|
4191 | elif node != parent: | |||
|
4192 | if util.any(repo.status()): | |||
|
4193 | hint = _("uncommitted changes, use --all to discard all" | |||
|
4194 | " changes, or 'hg update %s' to update") % ctx.rev() | |||
|
4195 | else: | |||
|
4196 | hint = _("use --all to revert all files," | |||
|
4197 | " or 'hg update %s' to update") % ctx.rev() | |||
4189 | raise util.Abort(msg, hint=hint) |
|
4198 | raise util.Abort(msg, hint=hint) | |
4190 |
|
4199 | |||
4191 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
|||
4192 | node = ctx.node() |
|
|||
4193 | mf = ctx.manifest() |
|
4200 | mf = ctx.manifest() | |
4194 | if node == parent: |
|
4201 | if node == parent: | |
4195 | pmf = mf |
|
4202 | pmf = mf |
@@ -186,7 +186,7 b' should fail - no arguments' | |||||
186 |
|
186 | |||
187 | $ hg revert -rtip |
|
187 | $ hg revert -rtip | |
188 | abort: no files or directories specified |
|
188 | abort: no files or directories specified | |
189 | (use --all to discard all changes) |
|
189 | (use --all to revert all files, or 'hg update 1' to update) | |
190 | [255] |
|
190 | [255] | |
191 |
|
191 | |||
192 | should succeed |
|
192 | should succeed |
General Comments 0
You need to be logged in to leave comments.
Login now