comparison tests/test-hgignore.t @ 33507:e9672de52a23

debugignore: eliminate inconsistencies with `hg status` (issue5222) Using a matcher for this command allows processing the named file(s) as relative to cwd. It also leverages the icasefs normalization logic the same way the status command does. (However, a false indicator is given for a nonexistent file in some cases, e.g. passing 'foo.REJ' when that file doesn't exist, and the rule is '*.rej'. Maybe the regex itself needs to be case insensitive on these platforms, at least for the debug command.) Finally, the file printed is relative to cwd and uses platform specific slashes, so a few (glob)s were needed in seemingly unrelated tests.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 15 Jul 2017 15:23:29 -0400
parents cc4632679cf9
children feecfefeba25
comparison
equal deleted inserted replaced
33506:8a1a7935c047 33507:e9672de52a23
49 49
50 $ echo "*.o" > .hgignore 50 $ echo "*.o" > .hgignore
51 $ hg status 51 $ hg status
52 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob) 52 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
53 [255] 53 [255]
54
55 Ensure given files are relative to cwd
56
57 $ echo "dir/.*\.o" > .hgignore
58 $ hg status -i
59 I dir/c.o
60
61 $ hg debugignore dir/c.o dir/missing.o
62 dir/c.o is ignored (glob)
63 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
64 dir/missing.o is ignored (glob)
65 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
66 $ cd dir
67 $ hg debugignore c.o missing.o
68 c.o is ignored
69 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
70 missing.o is ignored
71 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
72
73 For icasefs, inexact matches also work, except for missing files
74
75 #if icasefs
76 $ hg debugignore c.O missing.O
77 c.o is ignored
78 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
79 missing.O is not ignored
80 #endif
81
82 $ cd ..
54 83
55 $ echo ".*\.o" > .hgignore 84 $ echo ".*\.o" > .hgignore
56 $ hg status 85 $ hg status
57 A dir/b.o 86 A dir/b.o
58 ? .hgignore 87 ? .hgignore
205 ? a.o 234 ? a.o
206 ? syntax 235 ? syntax
207 $ hg debugignore a.c 236 $ hg debugignore a.c
208 a.c is not ignored 237 a.c is not ignored
209 $ hg debugignore dir/c.o 238 $ hg debugignore dir/c.o
210 dir/c.o is ignored 239 dir/c.o is ignored (glob)
211 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob) 240 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
212 241
213 Check using 'include:' in ignore file 242 Check using 'include:' in ignore file
214 243
215 $ hg purge --all --config extensions.purge= 244 $ hg purge --all --config extensions.purge=
291 $ echo "glob:file*2" > dir1/.hgignoretwo 320 $ echo "glob:file*2" > dir1/.hgignoretwo
292 321
293 $ hg status | grep file2 322 $ hg status | grep file2
294 [1] 323 [1]
295 $ hg debugignore dir1/file2 324 $ hg debugignore dir1/file2
296 dir1/file2 is ignored 325 dir1/file2 is ignored (glob)
297 (ignore rule in dir2/.hgignore, line 1: 'file*2') 326 (ignore rule in dir2/.hgignore, line 1: 'file*2')
298 327
299 #if windows 328 #if windows
300 329
301 Windows paths are accepted on input 330 Windows paths are accepted on input