4182 ctx = scmutil.revsingle(repo, opts.get('rev')) |
4182 ctx = scmutil.revsingle(repo, opts.get('rev')) |
4183 node = ctx.node() |
4183 node = ctx.node() |
4184 |
4184 |
4185 if not pats and not opts.get('all'): |
4185 if not pats and not opts.get('all'): |
4186 msg = _("no files or directories specified") |
4186 msg = _("no files or directories specified") |
4187 hint = _("use --all to discard all changes") |
|
4188 if p2 != nullid: |
4187 if p2 != nullid: |
4189 hint = _("uncommitted merge, use --all to discard all changes," |
4188 hint = _("uncommitted merge, use --all to discard all changes," |
4190 " or 'hg update -C .' to abort the merge") |
4189 " or 'hg update -C .' to abort the merge") |
4191 elif node != parent: |
4190 raise util.Abort(msg, hint=hint) |
4192 if util.any(repo.status()): |
4191 dirty = util.any(repo.status()) |
|
4192 if node != parent: |
|
4193 if dirty: |
4193 hint = _("uncommitted changes, use --all to discard all" |
4194 hint = _("uncommitted changes, use --all to discard all" |
4194 " changes, or 'hg update %s' to update") % ctx.rev() |
4195 " changes, or 'hg update %s' to update") % ctx.rev() |
4195 else: |
4196 else: |
4196 hint = _("use --all to revert all files," |
4197 hint = _("use --all to revert all files," |
4197 " or 'hg update %s' to update") % ctx.rev() |
4198 " or 'hg update %s' to update") % ctx.rev() |
|
4199 elif dirty: |
|
4200 hint = _("uncommitted changes, use --all to discard all changes") |
|
4201 else: |
|
4202 hint = _("use --all to revert all files") |
4198 raise util.Abort(msg, hint=hint) |
4203 raise util.Abort(msg, hint=hint) |
4199 |
4204 |
4200 mf = ctx.manifest() |
4205 mf = ctx.manifest() |
4201 if node == parent: |
4206 if node == parent: |
4202 pmf = mf |
4207 pmf = mf |