[PATCH 2 of 4 V6 STABLE] revert: be more helpful on uncommitted merges
Kevin Bullock
kbullock+mercurial at ringworld.org
Mon Jun 20 23:11:08 CDT 2011
# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1308626671 18000
# Branch stable
# Node ID 59f92ee58bc1ff014d11d009ab8e39ae86fb5af7
# Parent 10a8c14a8fdca3d00fee266b3af949f2bd5d74e5
revert: be more helpful on uncommitted merges
BEFORE:
$ hg revert
abort: no files or directories specified
(use --all to discard all changes)
AFTER:
$ hg revert
abort: no files or directories specified
(use --all to discard all changes, or 'hg update -C .' to cancel uncommitted merge)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4181,8 +4181,12 @@
parent, p2 = repo.dirstate.parents()
if not pats and not opts.get('all'):
- raise util.Abort(_('no files or directories specified'),
- hint=_('use --all to discard all changes'))
+ msg = _('no files or directories specified')
+ hint = _('use --all to discard all changes')
+ if p2 != nullid:
+ hint = _('use --all to discard all changes, or '
+ "'hg update -C .' to cancel uncommitted merge")
+ raise util.Abort(msg, hint=hint)
ctx = scmutil.revsingle(repo, opts.get('rev'))
node = ctx.node()
diff --git a/tests/test-confused-revert.t b/tests/test-confused-revert.t
--- a/tests/test-confused-revert.t
+++ b/tests/test-confused-revert.t
@@ -60,7 +60,7 @@
$ hg revert
abort: no files or directories specified
- (use --all to discard all changes)
+ (use --all to discard all changes, or 'hg update -C .' to cancel uncommitted merge)
[255]
Revert should be ok now:
More information about the Mercurial-devel
mailing list