annotate tests/test-hgignore.t @ 47281:6763913fa175

dirstate-v2: Add a variant of some tests, that uses the new format With this, the new format receives some testing every time someone runs tests with Rust extensions enabled, including on CI. Differential Revision: https://phab.mercurial-scm.org/D10720
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 19 May 2021 13:15:00 +0200
parents 93eb6c8035a9
children 0ef8231e413f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47281
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
1 #testcases dirstate-v1 dirstate-v1-tree dirstate-v2
47129
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
2
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
3 #if dirstate-v1-tree
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
4 #require rust
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
5 $ echo '[experimental]' >> $HGRCPATH
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
6 $ echo 'dirstate-tree.in-memory=1' >> $HGRCPATH
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
7 #endif
93eb6c8035a9 dirstate-tree: Add a dirstate-v1-tree variant of some tests
Simon Sapin <simon.sapin@octobus.net>
parents: 42864
diff changeset
8
47281
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
9 #if dirstate-v2
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
10 #require rust
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
11 $ echo '[format]' >> $HGRCPATH
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
12 $ echo 'exp-dirstate-v2=1' >> $HGRCPATH
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
13 #endif
6763913fa175 dirstate-v2: Add a variant of some tests, that uses the new format
Simon Sapin <simon.sapin@octobus.net>
parents: 47129
diff changeset
14
25869
a72e304df528 test: move ignore test run into a subdirectory
Durham Goode <durham@fb.com>
parents: 25283
diff changeset
15 $ hg init ignorerepo
a72e304df528 test: move ignore test run into a subdirectory
Durham Goode <durham@fb.com>
parents: 25283
diff changeset
16 $ cd ignorerepo
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
17
32605
e6ff007e107e match: introduce nevermatcher for when no ignore files are present
Siddharth Agarwal <sid0@fb.com>
parents: 32502
diff changeset
18 debugignore with no hgignore should be deterministic:
e6ff007e107e match: introduce nevermatcher for when no ignore files are present
Siddharth Agarwal <sid0@fb.com>
parents: 32502
diff changeset
19 $ hg debugignore
e6ff007e107e match: introduce nevermatcher for when no ignore files are present
Siddharth Agarwal <sid0@fb.com>
parents: 32502
diff changeset
20 <nevermatcher>
e6ff007e107e match: introduce nevermatcher for when no ignore files are present
Siddharth Agarwal <sid0@fb.com>
parents: 32502
diff changeset
21
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12376
diff changeset
22 Issue562: .hgignore requires newline at end:
4439
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
23
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
24 $ touch foo
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
25 $ touch bar
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
26 $ touch baz
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
27 $ cat > makeignore.py <<EOF
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
28 > f = open(".hgignore", "w")
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
29 > f.write("ignore\n")
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
30 > f.write("foo\n")
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
31 > # No EOL here
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
32 > f.write("bar")
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
33 > f.close()
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
34 > EOF
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
35
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 35393
diff changeset
36 $ "$PYTHON" makeignore.py
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
37
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
38 Should display baz only:
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
39
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
40 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
41 ? baz
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
42
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
43 $ rm foo bar baz .hgignore makeignore.py
4439
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
44
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
45 $ touch a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
46 $ touch a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
47 $ touch syntax
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
48 $ mkdir dir
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
49 $ touch dir/a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
50 $ touch dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
51 $ touch dir/c.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
52
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
53 $ hg add dir/a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
54 $ hg commit -m 0
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
55 $ hg add dir/b.o
4439
4e521a3ee5eb Test issue 562: .hgignore requires newline at end
Patrick Mezard <pmezard@gmail.com>
parents: 2009
diff changeset
56
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
57 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
58 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
59 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
60 ? a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
61 ? dir/c.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
62 ? syntax
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
63
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
64 $ echo "*.o" > .hgignore
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12312
diff changeset
65 $ hg status
25869
a72e304df528 test: move ignore test run into a subdirectory
Durham Goode <durham@fb.com>
parents: 25283
diff changeset
66 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12312
diff changeset
67 [255]
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
68
33507
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
69 Ensure given files are relative to cwd
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
70
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
71 $ echo "dir/.*\.o" > .hgignore
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
72 $ hg status -i
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
73 I dir/c.o
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
74
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
75 $ hg debugignore dir/c.o dir/missing.o
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
76 dir/c.o is ignored
33507
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
77 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
78 dir/missing.o is ignored
33507
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
79 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
80 $ cd dir
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
81 $ hg debugignore c.o missing.o
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
82 c.o is ignored
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
83 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
84 missing.o is ignored
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
85 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
86
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
87 For icasefs, inexact matches also work, except for missing files
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
88
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
89 #if icasefs
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
90 $ hg debugignore c.O missing.O
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
91 c.o is ignored
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
92 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob)
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
93 missing.O is not ignored
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
94 #endif
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
95
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
96 $ cd ..
e9672de52a23 debugignore: eliminate inconsistencies with `hg status` (issue5222)
Matt Harbison <matt_harbison@yahoo.com>
parents: 33477
diff changeset
97
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
98 $ echo ".*\.o" > .hgignore
16487
4fe874697a4d tests: fix incorrect markup of continued lines of sh commands
Mads Kiilerich <mads@kiilerich.com>
parents: 15447
diff changeset
99 $ hg status
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
100 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
101 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
102 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
103 ? syntax
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
104
27326
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
105 Ensure that comments work:
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
106
42633
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
107 $ touch 'foo#bar' 'quux#' 'quu0#'
27381
988367ac2a2a test-hgignore: conditionalize an illegal Windows filename
Matt Harbison <matt_harbison@yahoo.com>
parents: 27326
diff changeset
108 #if no-windows
42633
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
109 $ touch 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\'
27381
988367ac2a2a test-hgignore: conditionalize an illegal Windows filename
Matt Harbison <matt_harbison@yahoo.com>
parents: 27326
diff changeset
110 #endif
42633
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
111
27326
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
112 $ cat <<'EOF' >> .hgignore
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
113 > # full-line comment
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
114 > # whitespace-only comment line
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
115 > syntax# pattern, no whitespace, then comment
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
116 > a.c # pattern, then whitespace, then comment
42631
24f0023bb8b1 hgignore: update \-escape test to reflect actual behavior
Yuya Nishihara <yuya@tcha.org>
parents: 41721
diff changeset
117 > baz\\# # (escaped) backslash, then comment
42632
c67e3f966867 hgignore: add a few more weird patterns to test case
Yuya Nishihara <yuya@tcha.org>
parents: 42631
diff changeset
118 > ba0\\\#w # (escaped) backslash, escaped comment character, then comment
c67e3f966867 hgignore: add a few more weird patterns to test case
Yuya Nishihara <yuya@tcha.org>
parents: 42631
diff changeset
119 > ba1\\\\# # (escaped) backslashes, then comment
27326
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
120 > foo\#b # escaped comment character
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
121 > quux\## escaped comment character at end of name
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
122 > EOF
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
123 $ hg status
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
124 A dir/b.o
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
125 ? .hgignore
42633
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
126 ? quu0#
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
127 ? quu0\ (no-windows !)
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
128
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
129 $ cat <<'EOF' > .hgignore
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
130 > .*\.o
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
131 > syntax: glob
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
132 > syntax# pattern, no whitespace, then comment
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
133 > a.c # pattern, then whitespace, then comment
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
134 > baz\\#* # (escaped) backslash, then comment
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
135 > ba0\\\#w* # (escaped) backslash, escaped comment character, then comment
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
136 > ba1\\\\#* # (escaped) backslashes, then comment
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
137 > foo\#b* # escaped comment character
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
138 > quux\## escaped comment character at end of name
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
139 > quu0[\#]# escaped comment character inside [...]
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
140 > EOF
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
141 $ hg status
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
142 A dir/b.o
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
143 ? .hgignore
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
144 ? ba1\\wat (no-windows !)
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
145 ? baz\wat (no-windows !)
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
146 ? quu0\ (no-windows !)
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
147
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
148 $ rm 'foo#bar' 'quux#' 'quu0#'
27381
988367ac2a2a test-hgignore: conditionalize an illegal Windows filename
Matt Harbison <matt_harbison@yahoo.com>
parents: 27326
diff changeset
149 #if no-windows
42633
f78f305454fd hgignore: add escape syntax test for glob patterns
Yuya Nishihara <yuya@tcha.org>
parents: 42632
diff changeset
150 $ rm 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\'
27381
988367ac2a2a test-hgignore: conditionalize an illegal Windows filename
Matt Harbison <matt_harbison@yahoo.com>
parents: 27326
diff changeset
151 #endif
27326
ee2d7b5daa8a test-hgignore.t: add tests for comments
Bryan O'Sullivan <bos@serpentine.com>
parents: 25870
diff changeset
152
33477
cc4632679cf9 tests: fix an incorrect description in test-ignore.t
Martin von Zweigbergk <martinvonz@google.com>
parents: 33214
diff changeset
153 Check that '^\.' does not ignore the root directory:
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
154
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
155 $ echo "^\." > .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
156 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
157 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
158 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
159 ? a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
160 ? dir/c.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
161 ? syntax
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
162
23628
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
163 Test that patterns from ui.ignore options are read:
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
164
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
165 $ echo > .hgignore
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
166 $ cat >> $HGRCPATH << EOF
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
167 > [ui]
25869
a72e304df528 test: move ignore test run into a subdirectory
Durham Goode <durham@fb.com>
parents: 25283
diff changeset
168 > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore
23628
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
169 > EOF
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
170 $ echo "glob:**.o" > .hg/testhgignore
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
171 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
172 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
173 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
174 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
175 ? syntax
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
176
23628
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
177 empty out testhgignore
7d7a4848fff4 test-hgignore: add testing for ui.ignore
Siddharth Agarwal <sid0@fb.com>
parents: 21815
diff changeset
178 $ echo > .hg/testhgignore
23629
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
179
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
180 Test relative ignore path (issue4473):
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
181
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
182 $ cat >> $HGRCPATH << EOF
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
183 > [ui]
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
184 > ignore.relative = .hg/testhgignorerel
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
185 > EOF
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
186 $ echo "glob:*.o" > .hg/testhgignorerel
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
187 $ cd dir
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
188 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
189 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
190 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
191 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
192 ? syntax
42862
96ddf83fc267 tests: show the pattern generated for a relative glob
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42633
diff changeset
193 $ hg debugignore
42864
72890d8f9860 match: simplify the regexps created for glob patterns
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42862
diff changeset
194 <includematcher includes='.*\\.o(?:/|$)'>
6479
31abcae33b4f dirstate: do not ignore current directory '.' (issue 1078)
Patrick Mezard <pmezard@gmail.com>
parents: 5029
diff changeset
195
23629
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
196 $ cd ..
a04c7b74b3d5 ignore: resolve ignore files relative to repo root (issue4473) (BC)
Siddharth Agarwal <sid0@fb.com>
parents: 23628
diff changeset
197 $ echo > .hg/testhgignorerel
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
198 $ echo "syntax: glob" > .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
199 $ echo "re:.*\.o" >> .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
200 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
201 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
202 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
203 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
204 ? syntax
5029
ac97e065cfc7 Fix re: and glob: patterns in .hgignore (reported by Brad Schick)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4439
diff changeset
205
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
206 $ echo "syntax: invalid" > .hgignore
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12312
diff changeset
207 $ hg status
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
208 $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid'
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
209 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
210 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
211 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
212 ? a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
213 ? dir/c.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
214 ? syntax
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
215
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
216 $ echo "syntax: glob" > .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
217 $ echo "*.o" >> .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
218 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
219 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
220 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
221 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
222 ? syntax
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
223
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
224 $ echo "relglob:syntax*" > .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
225 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
226 A dir/b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
227 ? .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
228 ? a.c
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
229 ? a.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
230 ? dir/c.o
1478
e6dd91a88b57 add a test for hgignore
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
231
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
232 $ echo "relglob:*" > .hgignore
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
233 $ hg status
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
234 A dir/b.o
1491
91c0e8d7ddcf fix a bug in dirstate.changes when cwd != repo.root
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1478
diff changeset
235
12312
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
236 $ cd dir
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
237 $ hg status .
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
238 A b.o
83a310f2f14a tests: unify test-hgignore
Adrian Buehlmann <adrian@cadifra.com>
parents: 6479
diff changeset
239
13396
3e66eec9a814 add debugignore which yields the combined ignore patten of the .hgignore files
jfh <jason@jasonfharris.com>
parents: 12640
diff changeset
240 $ hg debugignore
42864
72890d8f9860 match: simplify the regexps created for glob patterns
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 42862
diff changeset
241 <includematcher includes='.*(?:/|$)'>
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16487
diff changeset
242
27671
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
243 $ hg debugignore b.o
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
244 b.o is ignored
27757
6ff556ef5a46 test-hgignore: add globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 27672
diff changeset
245 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob)
27671
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
246
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16487
diff changeset
247 $ cd ..
19128
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
248
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
249 Check patterns that match only the directory
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
250
33214
7367b76ef75c tests: add line specific for testing with fsmonitor
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32940
diff changeset
251 "(fsmonitor !)" below assumes that fsmonitor is enabled with
7367b76ef75c tests: add line specific for testing with fsmonitor
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32940
diff changeset
252 "walk_on_invalidate = false" (default), which doesn't involve
7367b76ef75c tests: add line specific for testing with fsmonitor
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32940
diff changeset
253 re-walking whole repository at detection of .hgignore change.
7367b76ef75c tests: add line specific for testing with fsmonitor
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32940
diff changeset
254
19128
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
255 $ echo "^dir\$" > .hgignore
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
256 $ hg status
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
257 A dir/b.o
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
258 ? .hgignore
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
259 ? a.c
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
260 ? a.o
33214
7367b76ef75c tests: add line specific for testing with fsmonitor
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 32940
diff changeset
261 ? dir/c.o (fsmonitor !)
19128
f4930b533d55 hgignore: fix regression with hgignore directory matches (issue3921)
Durham Goode <durham@fb.com>
parents: 16913
diff changeset
262 ? syntax
21815
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
263
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
264 Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o)
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
265
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
266 $ echo "syntax: glob" > .hgignore
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
267 $ echo "dir/**/c.o" >> .hgignore
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
268 $ touch dir/c.o
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
269 $ mkdir dir/subdir
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
270 $ touch dir/subdir/c.o
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
271 $ hg status
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
272 A dir/b.o
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
273 ? .hgignore
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
274 ? a.c
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
275 ? a.o
a4b67bf1f0a5 match: make glob '**/' match the empty string
Siddharth Agarwal <sid0@fb.com>
parents: 19128
diff changeset
276 ? syntax
27671
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
277 $ hg debugignore a.c
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
278 a.c is not ignored
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
279 $ hg debugignore dir/c.o
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
280 dir/c.o is ignored
27757
6ff556ef5a46 test-hgignore: add globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 27672
diff changeset
281 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
25215
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
282
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
283 Check rooted globs
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
284
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
285 $ hg purge --all --config extensions.purge=
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
286 $ echo "syntax: rootglob" > .hgignore
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
287 $ echo "a/*.ext" >> .hgignore
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
288 $ for p in a b/a aa; do mkdir -p $p; touch $p/b.ext; done
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
289 $ hg status -A 'set:**.ext'
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
290 ? aa/b.ext
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
291 ? b/a/b.ext
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
292 I a/b.ext
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
293
25215
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
294 Check using 'include:' in ignore file
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
295
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
296 $ hg purge --all --config extensions.purge=
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
297 $ touch foo.included
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
298
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
299 $ echo ".*.included" > otherignore
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
300 $ hg status -I "include:otherignore"
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
301 ? foo.included
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
302
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
303 $ echo "include:otherignore" >> .hgignore
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
304 $ hg status
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
305 A dir/b.o
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
306 ? .hgignore
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
307 ? otherignore
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
308
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
309 Check recursive uses of 'include:'
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
310
25870
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
311 $ echo "include:nested/ignore" >> otherignore
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
312 $ mkdir nested nested/more
25870
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
313 $ echo "glob:*ignore" > nested/ignore
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
314 $ echo "rootglob:a" >> nested/ignore
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
315 $ touch a nested/a nested/more/a
25215
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
316 $ hg status
4040e06e9b99 match: add 'include:' syntax
Durham Goode <durham@fb.com>
parents: 23629
diff changeset
317 A dir/b.o
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
318 ? nested/a
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
319 ? nested/more/a
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
320 $ rm a nested/a nested/more/a
25216
dc562165044a ignore: use 'include:' rules instead of custom syntax
Durham Goode <durham@fb.com>
parents: 25215
diff changeset
321
25283
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
322 $ cp otherignore goodignore
25216
dc562165044a ignore: use 'include:' rules instead of custom syntax
Durham Goode <durham@fb.com>
parents: 25215
diff changeset
323 $ echo "include:badignore" >> otherignore
dc562165044a ignore: use 'include:' rules instead of custom syntax
Durham Goode <durham@fb.com>
parents: 25215
diff changeset
324 $ hg status
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 33507
diff changeset
325 skipping unreadable pattern file 'badignore': $ENOENT$
25216
dc562165044a ignore: use 'include:' rules instead of custom syntax
Durham Goode <durham@fb.com>
parents: 25215
diff changeset
326 A dir/b.o
25283
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
327
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
328 $ mv goodignore otherignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
329
25870
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
330 Check using 'include:' while in a non-root directory
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
331
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
332 $ cd ..
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
333 $ hg -R ignorerepo status
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
334 A dir/b.o
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
335 $ cd ignorerepo
3de48ff62733 ignore: fix include: rules depending on current directory (issue4759)
Durham Goode <durham@fb.com>
parents: 25869
diff changeset
336
25283
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
337 Check including subincludes
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
338
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
339 $ hg revert -q --all
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
340 $ hg purge --all --config extensions.purge=
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
341 $ echo ".hgignore" > .hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
342 $ mkdir dir1 dir2
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
343 $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
344 $ echo "subinclude:dir2/.hgignore" >> .hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
345 $ echo "glob:file*2" > dir2/.hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
346 $ hg status
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
347 ? dir1/file1
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
348 ? dir1/file2
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
349 ? dir2/file1
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
350
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
351 Check including subincludes with other patterns
25283
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
352
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
353 $ echo "subinclude:dir1/.hgignore" >> .hgignore
41282
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
354
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
355 $ mkdir dir1/subdir
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
356 $ touch dir1/subdir/file1
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
357 $ echo "rootglob:f?le1" > dir1/.hgignore
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
358 $ hg status
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
359 ? dir1/file2
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
360 ? dir1/subdir/file1
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
361 ? dir2/file1
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
362 $ rm dir1/subdir/file1
4fab8a7d2d72 match: support rooted globs in hgignore
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents: 40782
diff changeset
363
25283
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
364 $ echo "regexp:f.le1" > dir1/.hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
365 $ hg status
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
366 ? dir1/file2
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
367 ? dir2/file1
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
368
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
369 Check multiple levels of sub-ignores
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
370
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
371 $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
372 $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
373 $ echo "glob:subfil*3" >> dir1/subdir/.hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
374
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
375 $ hg status
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
376 ? dir1/file2
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
377 ? dir1/subdir/subfile4
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
378 ? dir2/file1
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
379
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
380 Check include subignore at the same level
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
381
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
382 $ mv dir1/subdir/.hgignore dir1/.hgignoretwo
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
383 $ echo "regexp:f.le1" > dir1/.hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
384 $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
385 $ echo "glob:file*2" > dir1/.hgignoretwo
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
386
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
387 $ hg status | grep file2
19d0e5efa6ca match: enable 'subinclude:' syntax
Durham Goode <durham@fb.com>
parents: 25216
diff changeset
388 [1]
27671
067d87feeb11 debugignore: find out if a file is being ignored
Laurent Charignon <lcharignon@fb.com>
parents: 27381
diff changeset
389 $ hg debugignore dir1/file2
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 35230
diff changeset
390 dir1/file2 is ignored
27672
f2da9bb87ae0 debugignore: find out why a file is being ignored (issue4856)
Laurent Charignon <lcharignon@fb.com>
parents: 27671
diff changeset
391 (ignore rule in dir2/.hgignore, line 1: 'file*2')
28054
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
392
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
393 #if windows
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
394
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
395 Windows paths are accepted on input
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
396
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
397 $ rm dir1/.hgignore
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
398 $ echo "dir1/file*" >> .hgignore
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
399 $ hg debugignore "dir1\file2"
41721
eb8a8af4cbd0 tests: correct the remaining fallout from recent path style changes on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 41282
diff changeset
400 dir1/file2 is ignored
28054
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
401 (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*')
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
402 $ hg up -qC .
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
403
8515b813976b debugignore: normalize the file before testing dirstate._ignore()
Matt Harbison <matt_harbison@yahoo.com>
parents: 27757
diff changeset
404 #endif