Mercurial > public > mercurial-scm > hg-stable
diff tests/test-commit-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 | 66399f2e92aa |
children | e45c6b153e51 |
line wrap: on
line diff
--- a/tests/test-commit-interactive.t Thu Apr 04 17:34:43 2019 -0700 +++ b/tests/test-commit-interactive.t Thu Apr 04 11:35:18 2019 +0200 @@ -26,10 +26,8 @@ > EOF diff --git a/empty-rw b/empty-rw new file mode 100644 - examine changes to 'empty-rw'? [Ynesfdaq?] n - - no changes to record - [1] + abort: empty commit message + [255] $ hg tip -p changeset: -1:000000000000 @@ -47,8 +45,6 @@ > EOF diff --git a/empty-rw b/empty-rw new file mode 100644 - examine changes to 'empty-rw'? [Ynesfdaq?] y - abort: empty commit message [255] @@ -72,12 +68,9 @@ $ hg commit -i -d '0 0' -m empty empty-rw<<EOF > y - > y > EOF diff --git a/empty-rw b/empty-rw new file mode 100644 - examine changes to 'empty-rw'? [Ynesfdaq?] y - $ hg tip -p changeset: 0:c0708cf4e46e @@ -249,8 +242,6 @@ > EOF diff --git a/plain b/plain new file mode 100644 - examine changes to 'plain'? [Ynesfdaq?] y - @@ -0,0 +1,10 @@ +1 +2 @@ -306,8 +297,6 @@ > EOF diff --git a/plain b/plain 1 hunks, 1 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -8,3 +8,4 @@ 7 8 9 @@ -325,8 +314,6 @@ > EOF diff --git a/plain b/plain 1 hunks, 1 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -9,3 +9,4 @@ 8 9 10 @@ -467,8 +454,6 @@ > EOF diff --git a/plain b/plain 1 hunks, 1 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -9,4 +9,4 @@ 8 9 10 @@ -480,8 +465,6 @@ diff --git a/plain2 b/plain2 new file mode 100644 - examine changes to 'plain2'? [Ynesfdaq?] y - @@ -0,0 +1,1 @@ +1 record change 2/2 to 'plain2'? [Ynesfdaq?] y @@ -504,8 +487,6 @@ > EOF diff --git a/plain b/plain 2 hunks, 3 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -1,4 +1,4 @@ -1 +2 @@ -524,8 +505,6 @@ diff --git a/plain2 b/plain2 1 hunks, 1 lines changed - examine changes to 'plain2'? [Ynesfdaq?] y - @@ -1,1 +1,2 @@ 1 +2 @@ -572,14 +551,11 @@ Record end $ hg commit -i -d '11 0' -m end-only plain <<EOF - > y > n > y > EOF diff --git a/plain b/plain 2 hunks, 4 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -1,9 +1,6 @@ -2 -2 @@ -630,8 +606,6 @@ > EOF diff --git a/plain b/plain 1 hunks, 3 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -1,6 +1,3 @@ -2 -2 @@ -671,14 +645,11 @@ Record end $ hg commit -i --traceback -d '13 0' -m end-again plain<<EOF - > y > n > y > EOF diff --git a/plain b/plain 2 hunks, 4 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -1,6 +1,9 @@ +1 +2 @@ -714,13 +685,10 @@ $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF > y > y - > y > n > EOF diff --git a/plain b/plain 3 hunks, 7 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -1,2 +1,5 @@ +1 +2 @@ -781,8 +749,6 @@ > EOF diff --git a/plain b/plain 1 hunks, 2 lines changed - examine changes to 'plain'? [Ynesfdaq?] y - @@ -9,3 +9,5 @@ 6 7 8 @@ -823,8 +789,6 @@ > EOF diff --git a/subdir/a b/subdir/a 1 hunks, 1 lines changed - examine changes to 'subdir/a'? [Ynesfdaq?] y - @@ -1,1 +1,2 @@ a +a @@ -879,6 +843,35 @@ abort: user quit [255] +Patterns + + $ hg commit -i 'glob:f*' << EOF + > y + > n + > y + > n + > EOF + diff --git a/subdir/f1 b/subdir/f1 + 1 hunks, 1 lines changed + examine changes to 'subdir/f1'? [Ynesfdaq?] y + + @@ -1,1 +1,2 @@ + a + +a + record change 1/2 to 'subdir/f1'? [Ynesfdaq?] n + + diff --git a/subdir/f2 b/subdir/f2 + 1 hunks, 1 lines changed + examine changes to 'subdir/f2'? [Ynesfdaq?] y + + @@ -1,1 +1,2 @@ + b + +b + record change 2/2 to 'subdir/f2'? [Ynesfdaq?] n + + no changes to record + [1] + #if gettext Test translated help message