diff tests/test-revert-interactive.t @ 42071:db72f9f6580e

interactive: do not prompt about files given in command line For commit and revert commands with --interactive and explicit files given in the command line, we now skip the invite to "examine changes to <file> ? [Ynesfdaq?]". The reason for this is that, if <file> is specified by the user, asking for confirmation is redundant. In patch.filterpatch(), we now use an optional "match" argument to conditionally call the prompt() function when entering a new "header" item. We use .exact() method to compare with files from the "header" in order to only consider (rel)path patterns. Add tests with glob patterns for commit and revert, to make sure we still ask to examine files in these cases.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 04 Apr 2019 11:35:18 +0200
parents c1d83d916e85
children f802a75da585
line wrap: on
line diff
--- a/tests/test-revert-interactive.t	Thu Apr 04 17:34:43 2019 -0700
+++ b/tests/test-revert-interactive.t	Thu Apr 04 11:35:18 2019 +0200
@@ -149,11 +149,9 @@
   g
 
 Test that a noop revert doesn't do an unnecessary backup
-  $ (echo y; echo n) | hg revert -i -r 2 folder1/g
+  $ (echo n) | hg revert -i -r 2 folder1/g
   diff --git a/folder1/g b/folder1/g
   1 hunks, 1 lines changed
-  examine changes to 'folder1/g'? [Ynesfdaq?] y
-  
   @@ -3,4 +3,3 @@
    3
    4
@@ -165,11 +163,9 @@
   g
 
 Test --no-backup
-  $ (echo y; echo y) | hg revert -i -C -r 2 folder1/g
+  $ (echo y) | hg revert -i -C -r 2 folder1/g
   diff --git a/folder1/g b/folder1/g
   1 hunks, 1 lines changed
-  examine changes to 'folder1/g'? [Ynesfdaq?] y
-  
   @@ -3,4 +3,3 @@
    3
    4
@@ -270,7 +266,6 @@
   M f
   M folder1/g
   $ hg revert --interactive f << EOF
-  > y
   > ?
   > y
   > n
@@ -278,8 +273,6 @@
   > EOF
   diff --git a/f b/f
   2 hunks, 2 lines changed
-  examine changes to 'f'? [Ynesfdaq?] y
-  
   @@ -1,6 +1,5 @@
   -a
    1
@@ -327,6 +320,25 @@
   4
   5
   $ rm f.orig
+
+Patterns
+
+  $ hg revert -i 'glob:f*' << EOF
+  > y
+  > n
+  > EOF
+  diff --git a/f b/f
+  1 hunks, 1 lines changed
+  examine changes to 'f'? [Ynesfdaq?] y
+  
+  @@ -4,4 +4,3 @@
+   3
+   4
+   5
+  -b
+  discard this change to 'f'? [Ynesfdaq?] n
+  
+
   $ hg update -C .
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved