4177 if opts.get("rev"): |
4177 if opts.get("rev"): |
4178 raise util.Abort(_("you can't specify a revision and a date")) |
4178 raise util.Abort(_("you can't specify a revision and a date")) |
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") |
4185 hint = _("use --all to discard all changes") |
4187 hint = _("use --all to discard all changes") |
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 |
4196 else: |
4203 else: |
4197 pmf = None |
4204 pmf = None |