Patchwork [1,of,2,v2] tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns

login
register
mail settings
Submitter Denis Laxalde
Date Feb. 14, 2018, 1:15 p.m.
Message ID <75a4598a4375d80d240c.1518614120@steppe.tls.logilab.fr>
Download mbox | patch
Permalink /patch/27911/
State Accepted
Headers show

Comments

Denis Laxalde - Feb. 14, 2018, 1:15 p.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1518377864 -3600
#      Sun Feb 11 20:37:44 2018 +0100
# Node ID 75a4598a4375d80d240c19625e2c43a069ba9618
# Parent  62a428bf63590f74024c6cc6c40b4178be086cc4
# Available At http://hg.logilab.org/users/dlaxalde/hg
#              hg pull http://hg.logilab.org/users/dlaxalde/hg -r 75a4598a4375
# EXP-Topic revert-interactive-pats
tests: add a test demonstrate that 'revert -i' ignores nonexistent patterns

As described in issue5789, when revert is called through:

  hg revert -i <some file that does not exist>

we'd expect the command to abort early. Currently, it just warns about
missing file but prompt about files unrelated to user arguments.

Patch

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
@@ -420,4 +420,17 @@  When a line without EOL is selected duri
   $ cat a
   0
 
+When specified pattern does not exist, we should exit early (issue5789).
+
+  $ hg files
+  a
+  $ hg rev b
+  b: no such file in rev b40d1912accf
+  $ hg rev -i b
+  b: no such file in rev b40d1912accf
+  diff --git a/a b/a
+  1 hunks, 1 lines changed
+  examine changes to 'a'? [Ynesfdaq?] abort: response expected
+  [255]
+
   $ cd ..