revert: do not requires '--all' if '--interative' is present
authorPierre-Yves David <pierre-yves.david@fb.com>
Sat, 11 Apr 2015 12:26:54 -0400
changeset 24698 a85c4ed1132f
parent 24697 52ff737c63d2
child 24699 64cd23a1bc13
revert: do not requires '--all' if '--interative' is present The '--all' option have been introduced in 890e285c52a1 (August 2006), most probably to prevent user shooting themselves in the foot. As the record process will let you, view and select the set of files and change you want to revert, I feel like the '--all' flag is superfluous in the '--interactive' case.
mercurial/commands.py
tests/test-revert-interactive.t
--- a/mercurial/commands.py	Thu Apr 09 16:18:38 2015 -0400
+++ b/mercurial/commands.py	Sat Apr 11 12:26:54 2015 -0400
@@ -5514,7 +5514,7 @@
 
     ctx = scmutil.revsingle(repo, opts.get('rev'))
 
-    if not pats and not opts.get('all'):
+    if not pats and not (opts.get('all') or opts.get('interactive')):
         msg = _("no files or directories specified")
         if p2 != nullid:
             hint = _("uncommitted merge, use --all to discard all changes,"
--- a/tests/test-revert-interactive.t	Thu Apr 09 16:18:38 2015 -0400
+++ b/tests/test-revert-interactive.t	Sat Apr 11 12:26:54 2015 -0400
@@ -121,6 +121,21 @@
   4
   5
   f
+
+Test that --interactive lift the need for --all
+
+  $ echo q | hg revert -i -r 2
+  reverting folder1/g (glob)
+  reverting folder2/h (glob)
+  diff -r 89ac3d72e4a4 folder1/g
+  1 hunks, 1 lines changed
+  examine changes to 'folder1/g'? [Ynesfdaq?] q
+  
+  abort: user quit
+  [255]
+  $ rm folder1/g.orig
+
+
   $ hg update -C 6
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg revert -i -r 2 --all -- << EOF