[PATCH] revert: warn of usage of --all and -i together
Laurent Charignon
lcharignon at fb.com
Thu Apr 16 21:34:03 UTC 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1429210221 25200
# Thu Apr 16 11:50:21 2015 -0700
# Node ID ada0cc881c7c9c13b09f00ffaa4a05968d67a43c
# Parent c560d8c687916cb70a6d54c2c9ddcb5c9e457be2
revert: warn of usage of --all and -i together
When using hg revert -i allows to select interactively the changes, if --all is
used in combination with -i, it is redundant and we should warn the user about
it.
Fix the test accordingly to:
- not use --all when it is not needed
- check that the warning is shown when using --all and -i together
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5500,6 +5500,11 @@
Returns 0 on success.
"""
+ if opts.get('interactive') and opts.get('all'):
+ # Here we assume that the user did not mean all but only some of the
+ # changes as he uses the interactive flag
+ ui.warn(_("(--interactive works on all changes no need for --all)\n"))
+ opts.pop('all')
if opts.get("date"):
if opts.get("rev"):
diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t
--- a/tests/test-revert-interactive.t
+++ b/tests/test-revert-interactive.t
@@ -48,6 +48,7 @@
> n
> n
> EOF
+ (--interactive works on all changes no need for --all)
reverting f
reverting folder1/g (glob)
removing folder1/i (glob)
@@ -138,7 +139,7 @@
$ hg update -C 6
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
- $ hg revert -i -r 2 --all -- << EOF
+ $ hg revert -i -r 2 -- << EOF
> y
> y
> y
More information about the Mercurial-devel
mailing list