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