Show More
@@ -1,437 +1,465 | |||||
1 | #testcases dirstate-v1 dirstate-v2 |
|
1 | #testcases dirstate-v1 dirstate-v2 | |
2 |
|
2 | |||
3 | #if dirstate-v2 |
|
3 | #if dirstate-v2 | |
4 | $ cat >> $HGRCPATH << EOF |
|
4 | $ cat >> $HGRCPATH << EOF | |
5 | > [format] |
|
5 | > [format] | |
6 | > use-dirstate-v2=1 |
|
6 | > use-dirstate-v2=1 | |
7 | > [storage] |
|
7 | > [storage] | |
8 | > dirstate-v2.slow-path=allow |
|
8 | > dirstate-v2.slow-path=allow | |
9 | > EOF |
|
9 | > EOF | |
10 | #endif |
|
10 | #endif | |
11 |
|
11 | |||
12 | $ hg init ignorerepo |
|
12 | $ hg init ignorerepo | |
13 | $ cd ignorerepo |
|
13 | $ cd ignorerepo | |
14 |
|
14 | |||
15 | debugignore with no hgignore should be deterministic: |
|
15 | debugignore with no hgignore should be deterministic: | |
16 | $ hg debugignore |
|
16 | $ hg debugignore | |
17 | <nevermatcher> |
|
17 | <nevermatcher> | |
18 |
|
18 | |||
19 | Issue562: .hgignore requires newline at end: |
|
19 | Issue562: .hgignore requires newline at end: | |
20 |
|
20 | |||
21 | $ touch foo |
|
21 | $ touch foo | |
22 | $ touch bar |
|
22 | $ touch bar | |
23 | $ touch baz |
|
23 | $ touch baz | |
24 | $ cat > makeignore.py <<EOF |
|
24 | $ cat > makeignore.py <<EOF | |
25 | > f = open(".hgignore", "w") |
|
25 | > f = open(".hgignore", "w") | |
26 | > f.write("ignore\n") |
|
26 | > f.write("ignore\n") | |
27 | > f.write("foo\n") |
|
27 | > f.write("foo\n") | |
28 | > # No EOL here |
|
28 | > # No EOL here | |
29 | > f.write("bar") |
|
29 | > f.write("bar") | |
30 | > f.close() |
|
30 | > f.close() | |
31 | > EOF |
|
31 | > EOF | |
32 |
|
32 | |||
33 | $ "$PYTHON" makeignore.py |
|
33 | $ "$PYTHON" makeignore.py | |
34 |
|
34 | |||
35 | Should display baz only: |
|
35 | Should display baz only: | |
36 |
|
36 | |||
37 | $ hg status |
|
37 | $ hg status | |
38 | ? baz |
|
38 | ? baz | |
39 |
|
39 | |||
40 | $ rm foo bar baz .hgignore makeignore.py |
|
40 | $ rm foo bar baz .hgignore makeignore.py | |
41 |
|
41 | |||
42 | $ touch a.o |
|
42 | $ touch a.o | |
43 | $ touch a.c |
|
43 | $ touch a.c | |
44 | $ touch syntax |
|
44 | $ touch syntax | |
45 | $ mkdir dir |
|
45 | $ mkdir dir | |
46 | $ touch dir/a.o |
|
46 | $ touch dir/a.o | |
47 | $ touch dir/b.o |
|
47 | $ touch dir/b.o | |
48 | $ touch dir/c.o |
|
48 | $ touch dir/c.o | |
49 |
|
49 | |||
50 | $ hg add dir/a.o |
|
50 | $ hg add dir/a.o | |
51 | $ hg commit -m 0 |
|
51 | $ hg commit -m 0 | |
52 | $ hg add dir/b.o |
|
52 | $ hg add dir/b.o | |
53 |
|
53 | |||
54 | $ hg status |
|
54 | $ hg status | |
55 | A dir/b.o |
|
55 | A dir/b.o | |
56 | ? a.c |
|
56 | ? a.c | |
57 | ? a.o |
|
57 | ? a.o | |
58 | ? dir/c.o |
|
58 | ? dir/c.o | |
59 | ? syntax |
|
59 | ? syntax | |
60 |
|
60 | |||
61 | $ echo "*.o" > .hgignore |
|
61 | $ echo "*.o" > .hgignore | |
62 | $ hg status |
|
62 | $ hg status | |
63 | abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob) |
|
63 | abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob) | |
64 | [255] |
|
64 | [255] | |
65 |
|
65 | |||
66 | $ echo 're:^(?!a).*\.o$' > .hgignore |
|
66 | $ echo 're:^(?!a).*\.o$' > .hgignore | |
67 | $ hg status |
|
67 | $ hg status | |
68 | A dir/b.o |
|
68 | A dir/b.o | |
69 | ? .hgignore |
|
69 | ? .hgignore | |
70 | ? a.c |
|
70 | ? a.c | |
71 | ? a.o |
|
71 | ? a.o | |
72 | ? syntax |
|
72 | ? syntax | |
73 | #if rhg |
|
73 | #if rhg | |
74 | $ hg status --config rhg.on-unsupported=abort |
|
74 | $ hg status --config rhg.on-unsupported=abort | |
75 | unsupported feature: Unsupported syntax regex parse error: |
|
75 | unsupported feature: Unsupported syntax regex parse error: | |
76 | ^(?:^(?!a).*\.o$) |
|
76 | ^(?:^(?!a).*\.o$) | |
77 | ^^^ |
|
77 | ^^^ | |
78 | error: look-around, including look-ahead and look-behind, is not supported |
|
78 | error: look-around, including look-ahead and look-behind, is not supported | |
79 | [252] |
|
79 | [252] | |
80 | #endif |
|
80 | #endif | |
81 |
|
81 | |||
82 | Ensure given files are relative to cwd |
|
82 | Ensure given files are relative to cwd | |
83 |
|
83 | |||
84 | $ echo "dir/.*\.o" > .hgignore |
|
84 | $ echo "dir/.*\.o" > .hgignore | |
85 | $ hg status -i |
|
85 | $ hg status -i | |
86 | I dir/c.o |
|
86 | I dir/c.o | |
87 |
|
87 | |||
88 | $ hg debugignore dir/c.o dir/missing.o |
|
88 | $ hg debugignore dir/c.o dir/missing.o | |
89 | dir/c.o is ignored |
|
89 | dir/c.o is ignored | |
90 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
90 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
91 | dir/missing.o is ignored |
|
91 | dir/missing.o is ignored | |
92 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
92 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
93 | $ cd dir |
|
93 | $ cd dir | |
94 | $ hg debugignore c.o missing.o |
|
94 | $ hg debugignore c.o missing.o | |
95 | c.o is ignored |
|
95 | c.o is ignored | |
96 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
96 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
97 | missing.o is ignored |
|
97 | missing.o is ignored | |
98 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
98 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
99 |
|
99 | |||
100 | For icasefs, inexact matches also work, except for missing files |
|
100 | For icasefs, inexact matches also work, except for missing files | |
101 |
|
101 | |||
102 | #if icasefs |
|
102 | #if icasefs | |
103 | $ hg debugignore c.O missing.O |
|
103 | $ hg debugignore c.O missing.O | |
104 | c.o is ignored |
|
104 | c.o is ignored | |
105 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) |
|
105 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: 'dir/.*\.o') (glob) | |
106 | missing.O is not ignored |
|
106 | missing.O is not ignored | |
107 | #endif |
|
107 | #endif | |
108 |
|
108 | |||
109 | $ cd .. |
|
109 | $ cd .. | |
110 |
|
110 | |||
111 | $ echo ".*\.o" > .hgignore |
|
111 | $ echo ".*\.o" > .hgignore | |
112 | $ hg status |
|
112 | $ hg status | |
113 | A dir/b.o |
|
113 | A dir/b.o | |
114 | ? .hgignore |
|
114 | ? .hgignore | |
115 | ? a.c |
|
115 | ? a.c | |
116 | ? syntax |
|
116 | ? syntax | |
117 |
|
117 | |||
118 | Ensure that comments work: |
|
118 | Ensure that comments work: | |
119 |
|
119 | |||
120 | $ touch 'foo#bar' 'quux#' 'quu0#' |
|
120 | $ touch 'foo#bar' 'quux#' 'quu0#' | |
121 | #if no-windows |
|
121 | #if no-windows | |
122 | $ touch 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' |
|
122 | $ touch 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' | |
123 | #endif |
|
123 | #endif | |
124 |
|
124 | |||
125 | $ cat <<'EOF' >> .hgignore |
|
125 | $ cat <<'EOF' >> .hgignore | |
126 | > # full-line comment |
|
126 | > # full-line comment | |
127 | > # whitespace-only comment line |
|
127 | > # whitespace-only comment line | |
128 | > syntax# pattern, no whitespace, then comment |
|
128 | > syntax# pattern, no whitespace, then comment | |
129 | > a.c # pattern, then whitespace, then comment |
|
129 | > a.c # pattern, then whitespace, then comment | |
130 | > baz\\# # (escaped) backslash, then comment |
|
130 | > baz\\# # (escaped) backslash, then comment | |
131 | > ba0\\\#w # (escaped) backslash, escaped comment character, then comment |
|
131 | > ba0\\\#w # (escaped) backslash, escaped comment character, then comment | |
132 | > ba1\\\\# # (escaped) backslashes, then comment |
|
132 | > ba1\\\\# # (escaped) backslashes, then comment | |
133 | > foo\#b # escaped comment character |
|
133 | > foo\#b # escaped comment character | |
134 | > quux\## escaped comment character at end of name |
|
134 | > quux\## escaped comment character at end of name | |
135 | > EOF |
|
135 | > EOF | |
136 | $ hg status |
|
136 | $ hg status | |
137 | A dir/b.o |
|
137 | A dir/b.o | |
138 | ? .hgignore |
|
138 | ? .hgignore | |
139 | ? quu0# |
|
139 | ? quu0# | |
140 | ? quu0\ (no-windows !) |
|
140 | ? quu0\ (no-windows !) | |
141 |
|
141 | |||
142 | $ cat <<'EOF' > .hgignore |
|
142 | $ cat <<'EOF' > .hgignore | |
143 | > .*\.o |
|
143 | > .*\.o | |
144 | > syntax: glob |
|
144 | > syntax: glob | |
145 | > syntax# pattern, no whitespace, then comment |
|
145 | > syntax# pattern, no whitespace, then comment | |
146 | > a.c # pattern, then whitespace, then comment |
|
146 | > a.c # pattern, then whitespace, then comment | |
147 | > baz\\#* # (escaped) backslash, then comment |
|
147 | > baz\\#* # (escaped) backslash, then comment | |
148 | > ba0\\\#w* # (escaped) backslash, escaped comment character, then comment |
|
148 | > ba0\\\#w* # (escaped) backslash, escaped comment character, then comment | |
149 | > ba1\\\\#* # (escaped) backslashes, then comment |
|
149 | > ba1\\\\#* # (escaped) backslashes, then comment | |
150 | > foo\#b* # escaped comment character |
|
150 | > foo\#b* # escaped comment character | |
151 | > quux\## escaped comment character at end of name |
|
151 | > quux\## escaped comment character at end of name | |
152 | > quu0[\#]# escaped comment character inside [...] |
|
152 | > quu0[\#]# escaped comment character inside [...] | |
153 | > EOF |
|
153 | > EOF | |
154 | $ hg status |
|
154 | $ hg status | |
155 | A dir/b.o |
|
155 | A dir/b.o | |
156 | ? .hgignore |
|
156 | ? .hgignore | |
157 | ? ba1\\wat (no-windows !) |
|
157 | ? ba1\\wat (no-windows !) | |
158 | ? baz\wat (no-windows !) |
|
158 | ? baz\wat (no-windows !) | |
159 | ? quu0\ (no-windows !) |
|
159 | ? quu0\ (no-windows !) | |
160 |
|
160 | |||
161 | $ rm 'foo#bar' 'quux#' 'quu0#' |
|
161 | $ rm 'foo#bar' 'quux#' 'quu0#' | |
162 | #if no-windows |
|
162 | #if no-windows | |
163 | $ rm 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' |
|
163 | $ rm 'baz\' 'baz\wat' 'ba0\#wat' 'ba1\\' 'ba1\\wat' 'quu0\' | |
164 | #endif |
|
164 | #endif | |
165 |
|
165 | |||
166 | Check that '^\.' does not ignore the root directory: |
|
166 | Check that '^\.' does not ignore the root directory: | |
167 |
|
167 | |||
168 | $ echo "^\." > .hgignore |
|
168 | $ echo "^\." > .hgignore | |
169 | $ hg status |
|
169 | $ hg status | |
170 | A dir/b.o |
|
170 | A dir/b.o | |
171 | ? a.c |
|
171 | ? a.c | |
172 | ? a.o |
|
172 | ? a.o | |
173 | ? dir/c.o |
|
173 | ? dir/c.o | |
174 | ? syntax |
|
174 | ? syntax | |
175 |
|
175 | |||
176 | Test that patterns from ui.ignore options are read: |
|
176 | Test that patterns from ui.ignore options are read: | |
177 |
|
177 | |||
178 | $ echo > .hgignore |
|
178 | $ echo > .hgignore | |
179 | $ cat >> $HGRCPATH << EOF |
|
179 | $ cat >> $HGRCPATH << EOF | |
180 | > [ui] |
|
180 | > [ui] | |
181 | > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore |
|
181 | > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore | |
182 | > EOF |
|
182 | > EOF | |
183 | $ echo "glob:**.o" > .hg/testhgignore |
|
183 | $ echo "glob:**.o" > .hg/testhgignore | |
184 | $ hg status |
|
184 | $ hg status | |
185 | A dir/b.o |
|
185 | A dir/b.o | |
186 | ? .hgignore |
|
186 | ? .hgignore | |
187 | ? a.c |
|
187 | ? a.c | |
188 | ? syntax |
|
188 | ? syntax | |
189 |
|
189 | |||
190 | empty out testhgignore |
|
190 | empty out testhgignore | |
191 | $ echo > .hg/testhgignore |
|
191 | $ echo > .hg/testhgignore | |
192 |
|
192 | |||
193 | Test relative ignore path (issue4473): |
|
193 | Test relative ignore path (issue4473): | |
194 |
|
194 | |||
195 | $ cat >> $HGRCPATH << EOF |
|
195 | $ cat >> $HGRCPATH << EOF | |
196 | > [ui] |
|
196 | > [ui] | |
197 | > ignore.relative = .hg/testhgignorerel |
|
197 | > ignore.relative = .hg/testhgignorerel | |
198 | > EOF |
|
198 | > EOF | |
199 | $ echo "glob:*.o" > .hg/testhgignorerel |
|
199 | $ echo "glob:*.o" > .hg/testhgignorerel | |
200 | $ cd dir |
|
200 | $ cd dir | |
201 | $ hg status |
|
201 | $ hg status | |
202 | A dir/b.o |
|
202 | A dir/b.o | |
203 | ? .hgignore |
|
203 | ? .hgignore | |
204 | ? a.c |
|
204 | ? a.c | |
205 | ? syntax |
|
205 | ? syntax | |
206 | $ hg debugignore |
|
206 | $ hg debugignore | |
207 | <includematcher includes='.*\\.o(?:/|$)'> |
|
207 | <includematcher includes='.*\\.o(?:/|$)'> | |
208 |
|
208 | |||
209 | $ cd .. |
|
209 | $ cd .. | |
210 | $ echo > .hg/testhgignorerel |
|
210 | $ echo > .hg/testhgignorerel | |
211 | $ echo "syntax: glob" > .hgignore |
|
211 | $ echo "syntax: glob" > .hgignore | |
212 | $ echo "re:.*\.o" >> .hgignore |
|
212 | $ echo "re:.*\.o" >> .hgignore | |
213 | $ hg status |
|
213 | $ hg status | |
214 | A dir/b.o |
|
214 | A dir/b.o | |
215 | ? .hgignore |
|
215 | ? .hgignore | |
216 | ? a.c |
|
216 | ? a.c | |
217 | ? syntax |
|
217 | ? syntax | |
218 |
|
218 | |||
219 | $ echo "syntax: invalid" > .hgignore |
|
219 | $ echo "syntax: invalid" > .hgignore | |
220 | $ hg status |
|
220 | $ hg status | |
221 | $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' |
|
221 | $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' | |
222 | A dir/b.o |
|
222 | A dir/b.o | |
223 | ? .hgignore |
|
223 | ? .hgignore | |
224 | ? a.c |
|
224 | ? a.c | |
225 | ? a.o |
|
225 | ? a.o | |
226 | ? dir/c.o |
|
226 | ? dir/c.o | |
227 | ? syntax |
|
227 | ? syntax | |
228 |
|
228 | |||
229 | $ echo "syntax: glob" > .hgignore |
|
229 | $ echo "syntax: glob" > .hgignore | |
230 | $ echo "*.o" >> .hgignore |
|
230 | $ echo "*.o" >> .hgignore | |
231 | $ hg status |
|
231 | $ hg status | |
232 | A dir/b.o |
|
232 | A dir/b.o | |
233 | ? .hgignore |
|
233 | ? .hgignore | |
234 | ? a.c |
|
234 | ? a.c | |
235 | ? syntax |
|
235 | ? syntax | |
236 |
|
236 | |||
237 | $ echo "relglob:syntax*" > .hgignore |
|
237 | $ echo "relglob:syntax*" > .hgignore | |
238 | $ hg status |
|
238 | $ hg status | |
239 | A dir/b.o |
|
239 | A dir/b.o | |
240 | ? .hgignore |
|
240 | ? .hgignore | |
241 | ? a.c |
|
241 | ? a.c | |
242 | ? a.o |
|
242 | ? a.o | |
243 | ? dir/c.o |
|
243 | ? dir/c.o | |
244 |
|
244 | |||
245 | $ echo "relglob:*" > .hgignore |
|
245 | $ echo "relglob:*" > .hgignore | |
246 | $ hg status |
|
246 | $ hg status | |
247 | A dir/b.o |
|
247 | A dir/b.o | |
248 |
|
248 | |||
249 | $ cd dir |
|
249 | $ cd dir | |
250 | $ hg status . |
|
250 | $ hg status . | |
251 | A b.o |
|
251 | A b.o | |
252 |
|
252 | |||
253 | $ hg debugignore |
|
253 | $ hg debugignore | |
254 | <includematcher includes='.*(?:/|$)'> |
|
254 | <includematcher includes='.*(?:/|$)'> | |
255 |
|
255 | |||
256 | $ hg debugignore b.o |
|
256 | $ hg debugignore b.o | |
257 | b.o is ignored |
|
257 | b.o is ignored | |
258 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob) |
|
258 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob) | |
259 |
|
259 | |||
260 | $ cd .. |
|
260 | $ cd .. | |
261 |
|
261 | |||
262 | Check patterns that match only the directory |
|
262 | Check patterns that match only the directory | |
263 |
|
263 | |||
264 | "(fsmonitor !)" below assumes that fsmonitor is enabled with |
|
264 | "(fsmonitor !)" below assumes that fsmonitor is enabled with | |
265 | "walk_on_invalidate = false" (default), which doesn't involve |
|
265 | "walk_on_invalidate = false" (default), which doesn't involve | |
266 | re-walking whole repository at detection of .hgignore change. |
|
266 | re-walking whole repository at detection of .hgignore change. | |
267 |
|
267 | |||
268 | $ echo "^dir\$" > .hgignore |
|
268 | $ echo "^dir\$" > .hgignore | |
269 | $ hg status |
|
269 | $ hg status | |
270 | A dir/b.o |
|
270 | A dir/b.o | |
271 | ? .hgignore |
|
271 | ? .hgignore | |
272 | ? a.c |
|
272 | ? a.c | |
273 | ? a.o |
|
273 | ? a.o | |
274 | ? dir/c.o (fsmonitor !) |
|
274 | ? dir/c.o (fsmonitor !) | |
275 | ? syntax |
|
275 | ? syntax | |
276 |
|
276 | |||
277 | Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o) |
|
277 | Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o) | |
278 |
|
278 | |||
279 | $ echo "syntax: glob" > .hgignore |
|
279 | $ echo "syntax: glob" > .hgignore | |
280 | $ echo "dir/**/c.o" >> .hgignore |
|
280 | $ echo "dir/**/c.o" >> .hgignore | |
281 | $ touch dir/c.o |
|
281 | $ touch dir/c.o | |
282 | $ mkdir dir/subdir |
|
282 | $ mkdir dir/subdir | |
283 | $ touch dir/subdir/c.o |
|
283 | $ touch dir/subdir/c.o | |
284 | $ hg status |
|
284 | $ hg status | |
285 | A dir/b.o |
|
285 | A dir/b.o | |
286 | ? .hgignore |
|
286 | ? .hgignore | |
287 | ? a.c |
|
287 | ? a.c | |
288 | ? a.o |
|
288 | ? a.o | |
289 | ? syntax |
|
289 | ? syntax | |
290 | $ hg debugignore a.c |
|
290 | $ hg debugignore a.c | |
291 | a.c is not ignored |
|
291 | a.c is not ignored | |
292 | $ hg debugignore dir/c.o |
|
292 | $ hg debugignore dir/c.o | |
293 | dir/c.o is ignored |
|
293 | dir/c.o is ignored | |
294 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob) |
|
294 | (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob) | |
295 |
|
295 | |||
296 | Check rooted globs |
|
296 | Check rooted globs | |
297 |
|
297 | |||
298 | $ hg purge --all --config extensions.purge= |
|
298 | $ hg purge --all --config extensions.purge= | |
299 | $ echo "syntax: rootglob" > .hgignore |
|
299 | $ echo "syntax: rootglob" > .hgignore | |
300 | $ echo "a/*.ext" >> .hgignore |
|
300 | $ echo "a/*.ext" >> .hgignore | |
301 | $ for p in a b/a aa; do mkdir -p $p; touch $p/b.ext; done |
|
301 | $ for p in a b/a aa; do mkdir -p $p; touch $p/b.ext; done | |
302 | $ hg status -A 'set:**.ext' |
|
302 | $ hg status -A 'set:**.ext' | |
303 | ? aa/b.ext |
|
303 | ? aa/b.ext | |
304 | ? b/a/b.ext |
|
304 | ? b/a/b.ext | |
305 | I a/b.ext |
|
305 | I a/b.ext | |
306 |
|
306 | |||
307 | Check using 'include:' in ignore file |
|
307 | Check using 'include:' in ignore file | |
308 |
|
308 | |||
309 | $ hg purge --all --config extensions.purge= |
|
309 | $ hg purge --all --config extensions.purge= | |
310 | $ touch foo.included |
|
310 | $ touch foo.included | |
311 |
|
311 | |||
312 | $ echo ".*.included" > otherignore |
|
312 | $ echo ".*.included" > otherignore | |
313 | $ hg status -I "include:otherignore" |
|
313 | $ hg status -I "include:otherignore" | |
314 | ? foo.included |
|
314 | ? foo.included | |
315 |
|
315 | |||
316 | $ echo "include:otherignore" >> .hgignore |
|
316 | $ echo "include:otherignore" >> .hgignore | |
317 | $ hg status |
|
317 | $ hg status | |
318 | A dir/b.o |
|
318 | A dir/b.o | |
319 | ? .hgignore |
|
319 | ? .hgignore | |
320 | ? otherignore |
|
320 | ? otherignore | |
321 |
|
321 | |||
322 | Check recursive uses of 'include:' |
|
322 | Check recursive uses of 'include:' | |
323 |
|
323 | |||
324 | $ echo "include:nested/ignore" >> otherignore |
|
324 | $ echo "include:nested/ignore" >> otherignore | |
325 | $ mkdir nested nested/more |
|
325 | $ mkdir nested nested/more | |
326 | $ echo "glob:*ignore" > nested/ignore |
|
326 | $ echo "glob:*ignore" > nested/ignore | |
327 | $ echo "rootglob:a" >> nested/ignore |
|
327 | $ echo "rootglob:a" >> nested/ignore | |
328 | $ touch a nested/a nested/more/a |
|
328 | $ touch a nested/a nested/more/a | |
329 | $ hg status |
|
329 | $ hg status | |
330 | A dir/b.o |
|
330 | A dir/b.o | |
331 | ? nested/a |
|
331 | ? nested/a | |
332 | ? nested/more/a |
|
332 | ? nested/more/a | |
333 | $ rm a nested/a nested/more/a |
|
333 | $ rm a nested/a nested/more/a | |
334 |
|
334 | |||
335 | $ cp otherignore goodignore |
|
335 | $ cp otherignore goodignore | |
336 | $ echo "include:badignore" >> otherignore |
|
336 | $ echo "include:badignore" >> otherignore | |
337 | $ hg status |
|
337 | $ hg status | |
338 | skipping unreadable pattern file 'badignore': $ENOENT$ |
|
338 | skipping unreadable pattern file 'badignore': $ENOENT$ | |
339 | A dir/b.o |
|
339 | A dir/b.o | |
340 |
|
340 | |||
341 | $ mv goodignore otherignore |
|
341 | $ mv goodignore otherignore | |
342 |
|
342 | |||
343 | Check using 'include:' while in a non-root directory |
|
343 | Check using 'include:' while in a non-root directory | |
344 |
|
344 | |||
345 | $ cd .. |
|
345 | $ cd .. | |
346 | $ hg -R ignorerepo status |
|
346 | $ hg -R ignorerepo status | |
347 | A dir/b.o |
|
347 | A dir/b.o | |
348 | $ cd ignorerepo |
|
348 | $ cd ignorerepo | |
349 |
|
349 | |||
350 | Check including subincludes |
|
350 | Check including subincludes | |
351 |
|
351 | |||
352 | $ hg revert -q --all |
|
352 | $ hg revert -q --all | |
353 | $ hg purge --all --config extensions.purge= |
|
353 | $ hg purge --all --config extensions.purge= | |
354 | $ echo ".hgignore" > .hgignore |
|
354 | $ echo ".hgignore" > .hgignore | |
355 | $ mkdir dir1 dir2 |
|
355 | $ mkdir dir1 dir2 | |
356 | $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2 |
|
356 | $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2 | |
357 | $ echo "subinclude:dir2/.hgignore" >> .hgignore |
|
357 | $ echo "subinclude:dir2/.hgignore" >> .hgignore | |
358 | $ echo "glob:file*2" > dir2/.hgignore |
|
358 | $ echo "glob:file*2" > dir2/.hgignore | |
359 | $ hg status |
|
359 | $ hg status | |
360 | ? dir1/file1 |
|
360 | ? dir1/file1 | |
361 | ? dir1/file2 |
|
361 | ? dir1/file2 | |
362 | ? dir2/file1 |
|
362 | ? dir2/file1 | |
363 |
|
363 | |||
364 | Check including subincludes with other patterns |
|
364 | Check including subincludes with other patterns | |
365 |
|
365 | |||
366 | $ echo "subinclude:dir1/.hgignore" >> .hgignore |
|
366 | $ echo "subinclude:dir1/.hgignore" >> .hgignore | |
367 |
|
367 | |||
368 | $ mkdir dir1/subdir |
|
368 | $ mkdir dir1/subdir | |
369 | $ touch dir1/subdir/file1 |
|
369 | $ touch dir1/subdir/file1 | |
370 | $ echo "rootglob:f?le1" > dir1/.hgignore |
|
370 | $ echo "rootglob:f?le1" > dir1/.hgignore | |
371 | $ hg status |
|
371 | $ hg status | |
372 | ? dir1/file2 |
|
372 | ? dir1/file2 | |
373 | ? dir1/subdir/file1 |
|
373 | ? dir1/subdir/file1 | |
374 | ? dir2/file1 |
|
374 | ? dir2/file1 | |
375 | $ rm dir1/subdir/file1 |
|
375 | $ rm dir1/subdir/file1 | |
376 |
|
376 | |||
377 | $ echo "regexp:f.le1" > dir1/.hgignore |
|
377 | $ echo "regexp:f.le1" > dir1/.hgignore | |
378 | $ hg status |
|
378 | $ hg status | |
379 | ? dir1/file2 |
|
379 | ? dir1/file2 | |
380 | ? dir2/file1 |
|
380 | ? dir2/file1 | |
381 |
|
381 | |||
382 | Check multiple levels of sub-ignores |
|
382 | Check multiple levels of sub-ignores | |
383 |
|
383 | |||
384 | $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4 |
|
384 | $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4 | |
385 | $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore |
|
385 | $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore | |
386 | $ echo "glob:subfil*3" >> dir1/subdir/.hgignore |
|
386 | $ echo "glob:subfil*3" >> dir1/subdir/.hgignore | |
387 |
|
387 | |||
388 | $ hg status |
|
388 | $ hg status | |
389 | ? dir1/file2 |
|
389 | ? dir1/file2 | |
390 | ? dir1/subdir/subfile4 |
|
390 | ? dir1/subdir/subfile4 | |
391 | ? dir2/file1 |
|
391 | ? dir2/file1 | |
392 |
|
392 | |||
393 | Check include subignore at the same level |
|
393 | Check include subignore at the same level | |
394 |
|
394 | |||
395 | $ mv dir1/subdir/.hgignore dir1/.hgignoretwo |
|
395 | $ mv dir1/subdir/.hgignore dir1/.hgignoretwo | |
396 | $ echo "regexp:f.le1" > dir1/.hgignore |
|
396 | $ echo "regexp:f.le1" > dir1/.hgignore | |
397 | $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore |
|
397 | $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore | |
398 | $ echo "glob:file*2" > dir1/.hgignoretwo |
|
398 | $ echo "glob:file*2" > dir1/.hgignoretwo | |
399 |
|
399 | |||
400 | $ hg status | grep file2 |
|
400 | $ hg status | grep file2 | |
401 | [1] |
|
401 | [1] | |
402 | $ hg debugignore dir1/file2 |
|
402 | $ hg debugignore dir1/file2 | |
403 | dir1/file2 is ignored |
|
403 | dir1/file2 is ignored | |
404 | (ignore rule in dir2/.hgignore, line 1: 'file*2') |
|
404 | (ignore rule in dir2/.hgignore, line 1: 'file*2') | |
405 |
|
405 | |||
406 | #if windows |
|
406 | #if windows | |
407 |
|
407 | |||
408 | Windows paths are accepted on input |
|
408 | Windows paths are accepted on input | |
409 |
|
409 | |||
410 | $ rm dir1/.hgignore |
|
410 | $ rm dir1/.hgignore | |
411 | $ echo "dir1/file*" >> .hgignore |
|
411 | $ echo "dir1/file*" >> .hgignore | |
412 | $ hg debugignore "dir1\file2" |
|
412 | $ hg debugignore "dir1\file2" | |
413 | dir1/file2 is ignored |
|
413 | dir1/file2 is ignored | |
414 | (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*') |
|
414 | (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*') | |
415 | $ hg up -qC . |
|
415 | $ hg up -qC . | |
416 |
|
416 | |||
417 | #endif |
|
417 | #endif | |
418 |
|
418 | |||
419 | #if dirstate-v2 rust |
|
419 | #if dirstate-v2 rust | |
420 |
|
420 | |||
421 | Check the hash of ignore patterns written in the dirstate |
|
421 | Check the hash of ignore patterns written in the dirstate | |
422 | This is an optimization that is only relevant when using the Rust extensions |
|
422 | This is an optimization that is only relevant when using the Rust extensions | |
423 |
|
423 | |||
424 | $ hg status > /dev/null |
|
424 | $ hg status > /dev/null | |
425 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 |
|
425 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | |
426 | sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff |
|
426 | sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | |
427 | $ hg debugstate --docket | grep ignore |
|
427 | $ hg debugstate --docket | grep ignore | |
428 | ignore pattern hash: 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff |
|
428 | ignore pattern hash: 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | |
429 |
|
429 | |||
430 | $ echo rel > .hg/testhgignorerel |
|
430 | $ echo rel > .hg/testhgignorerel | |
431 | $ hg status > /dev/null |
|
431 | $ hg status > /dev/null | |
432 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 |
|
432 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | |
433 | sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e |
|
433 | sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e | |
434 | $ hg debugstate --docket | grep ignore |
|
434 | $ hg debugstate --docket | grep ignore | |
435 | ignore pattern hash: dea19cc7119213f24b6b582a4bae7b0cb063e34e |
|
435 | ignore pattern hash: dea19cc7119213f24b6b582a4bae7b0cb063e34e | |
|
436 | $ cd .. | |||
|
437 | ||||
|
438 | Check that the hash depends on the source of the hgignore patterns | |||
|
439 | (otherwise the context is lost and things like subinclude are cached improperly) | |||
|
440 | ||||
|
441 | $ hg init ignore-collision | |||
|
442 | $ cd ignore-collision | |||
|
443 | $ echo > .hg/testhgignorerel | |||
|
444 | ||||
|
445 | $ mkdir dir1/ dir1/subdir | |||
|
446 | $ touch dir1/subdir/f dir1/subdir/ignored1 | |||
|
447 | $ echo 'ignored1' > dir1/.hgignore | |||
|
448 | ||||
|
449 | $ mkdir dir2 dir2/subdir | |||
|
450 | $ touch dir2/subdir/f dir2/subdir/ignored2 | |||
|
451 | $ echo 'ignored2' > dir2/.hgignore | |||
|
452 | $ echo 'subinclude:dir2/.hgignore' >> .hgignore | |||
|
453 | $ echo 'subinclude:dir1/.hgignore' >> .hgignore | |||
|
454 | ||||
|
455 | $ hg commit -Aqm_ | |||
|
456 | ||||
|
457 | $ > dir1/.hgignore | |||
|
458 | $ echo 'ignored' > dir2/.hgignore | |||
|
459 | $ echo 'ignored1' >> dir2/.hgignore | |||
|
460 | $ hg status | |||
|
461 | M dir1/.hgignore | |||
|
462 | M dir2/.hgignore | |||
|
463 | ? dir1/subdir/ignored1 (missing-correct-output !) | |||
436 |
|
464 | |||
437 | #endif |
|
465 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now