Mercurial > hg-stable
changeset 13022:3fd4e4e81382
revert: improve merge advice and favor its error over all
author | timeless <timeless@gmail.com> |
---|---|
date | Sat, 20 Nov 2010 20:41:48 +0200 |
parents | 42ac864ed394 |
children | 3e2281b85990 |
files | mercurial/commands.py tests/test-confused-revert.t |
diffstat | 2 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Nov 17 16:54:30 2010 +0100 +++ b/mercurial/commands.py Sat Nov 20 20:41:48 2010 +0200 @@ -3105,14 +3105,15 @@ raise util.Abort(_("you can't specify a revision and a date")) opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) + parent, p2 = repo.dirstate.parents() + if not opts.get('rev') and p2 != nullid: + raise util.Abort(_('uncommitted merge - ' + 'use "hg update", see "hg help revert"')) + if not pats and not opts.get('all'): raise util.Abort(_('no files or directories specified; ' 'use --all to revert the whole repo')) - parent, p2 = repo.dirstate.parents() - if not opts.get('rev') and p2 != nullid: - raise util.Abort(_('uncommitted merge - please provide a ' - 'specific revision')) ctx = cmdutil.revsingle(repo, opts.get('rev')) node = ctx.node() mf = ctx.manifest()
--- a/tests/test-confused-revert.t Wed Nov 17 16:54:30 2010 +0100 +++ b/tests/test-confused-revert.t Sat Nov 20 20:41:48 2010 +0200 @@ -58,8 +58,8 @@ Revert should fail: - $ hg revert --all - abort: uncommitted merge - please provide a specific revision + $ hg revert + abort: uncommitted merge - use "hg update", see "hg help revert" [255] Revert should be ok now: