##// END OF EJS Templates
tests: add line specific for testing with fsmonitor
FUJIWARA Katsunori -
r33211:7367b76e default
parent child Browse files
Show More
@@ -1,305 +1,310
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 $ echo ".*\.o" > .hgignore
55 $ echo ".*\.o" > .hgignore
56 $ hg status
56 $ hg status
57 A dir/b.o
57 A dir/b.o
58 ? .hgignore
58 ? .hgignore
59 ? a.c
59 ? a.c
60 ? syntax
60 ? syntax
61
61
62 Ensure that comments work:
62 Ensure that comments work:
63
63
64 $ touch 'foo#bar' 'quux#'
64 $ touch 'foo#bar' 'quux#'
65 #if no-windows
65 #if no-windows
66 $ touch 'baz\#wat'
66 $ touch 'baz\#wat'
67 #endif
67 #endif
68 $ cat <<'EOF' >> .hgignore
68 $ cat <<'EOF' >> .hgignore
69 > # full-line comment
69 > # full-line comment
70 > # whitespace-only comment line
70 > # whitespace-only comment line
71 > syntax# pattern, no whitespace, then comment
71 > syntax# pattern, no whitespace, then comment
72 > a.c # pattern, then whitespace, then comment
72 > a.c # pattern, then whitespace, then comment
73 > baz\\# # escaped comment character
73 > baz\\# # escaped comment character
74 > foo\#b # escaped comment character
74 > foo\#b # escaped comment character
75 > quux\## escaped comment character at end of name
75 > quux\## escaped comment character at end of name
76 > EOF
76 > EOF
77 $ hg status
77 $ hg status
78 A dir/b.o
78 A dir/b.o
79 ? .hgignore
79 ? .hgignore
80 $ rm 'foo#bar' 'quux#'
80 $ rm 'foo#bar' 'quux#'
81 #if no-windows
81 #if no-windows
82 $ rm 'baz\#wat'
82 $ rm 'baz\#wat'
83 #endif
83 #endif
84
84
85 Check it does not ignore the current directory '.':
85 Check it does not ignore the current directory '.':
86
86
87 $ echo "^\." > .hgignore
87 $ echo "^\." > .hgignore
88 $ hg status
88 $ hg status
89 A dir/b.o
89 A dir/b.o
90 ? a.c
90 ? a.c
91 ? a.o
91 ? a.o
92 ? dir/c.o
92 ? dir/c.o
93 ? syntax
93 ? syntax
94
94
95 Test that patterns from ui.ignore options are read:
95 Test that patterns from ui.ignore options are read:
96
96
97 $ echo > .hgignore
97 $ echo > .hgignore
98 $ cat >> $HGRCPATH << EOF
98 $ cat >> $HGRCPATH << EOF
99 > [ui]
99 > [ui]
100 > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore
100 > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore
101 > EOF
101 > EOF
102 $ echo "glob:**.o" > .hg/testhgignore
102 $ echo "glob:**.o" > .hg/testhgignore
103 $ hg status
103 $ hg status
104 A dir/b.o
104 A dir/b.o
105 ? .hgignore
105 ? .hgignore
106 ? a.c
106 ? a.c
107 ? syntax
107 ? syntax
108
108
109 empty out testhgignore
109 empty out testhgignore
110 $ echo > .hg/testhgignore
110 $ echo > .hg/testhgignore
111
111
112 Test relative ignore path (issue4473):
112 Test relative ignore path (issue4473):
113
113
114 $ cat >> $HGRCPATH << EOF
114 $ cat >> $HGRCPATH << EOF
115 > [ui]
115 > [ui]
116 > ignore.relative = .hg/testhgignorerel
116 > ignore.relative = .hg/testhgignorerel
117 > EOF
117 > EOF
118 $ echo "glob:*.o" > .hg/testhgignorerel
118 $ echo "glob:*.o" > .hg/testhgignorerel
119 $ cd dir
119 $ cd dir
120 $ hg status
120 $ hg status
121 A dir/b.o
121 A dir/b.o
122 ? .hgignore
122 ? .hgignore
123 ? a.c
123 ? a.c
124 ? syntax
124 ? syntax
125
125
126 $ cd ..
126 $ cd ..
127 $ echo > .hg/testhgignorerel
127 $ echo > .hg/testhgignorerel
128 $ echo "syntax: glob" > .hgignore
128 $ echo "syntax: glob" > .hgignore
129 $ echo "re:.*\.o" >> .hgignore
129 $ echo "re:.*\.o" >> .hgignore
130 $ hg status
130 $ hg status
131 A dir/b.o
131 A dir/b.o
132 ? .hgignore
132 ? .hgignore
133 ? a.c
133 ? a.c
134 ? syntax
134 ? syntax
135
135
136 $ echo "syntax: invalid" > .hgignore
136 $ echo "syntax: invalid" > .hgignore
137 $ hg status
137 $ hg status
138 $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' (glob)
138 $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' (glob)
139 A dir/b.o
139 A dir/b.o
140 ? .hgignore
140 ? .hgignore
141 ? a.c
141 ? a.c
142 ? a.o
142 ? a.o
143 ? dir/c.o
143 ? dir/c.o
144 ? syntax
144 ? syntax
145
145
146 $ echo "syntax: glob" > .hgignore
146 $ echo "syntax: glob" > .hgignore
147 $ echo "*.o" >> .hgignore
147 $ echo "*.o" >> .hgignore
148 $ hg status
148 $ hg status
149 A dir/b.o
149 A dir/b.o
150 ? .hgignore
150 ? .hgignore
151 ? a.c
151 ? a.c
152 ? syntax
152 ? syntax
153
153
154 $ echo "relglob:syntax*" > .hgignore
154 $ echo "relglob:syntax*" > .hgignore
155 $ hg status
155 $ hg status
156 A dir/b.o
156 A dir/b.o
157 ? .hgignore
157 ? .hgignore
158 ? a.c
158 ? a.c
159 ? a.o
159 ? a.o
160 ? dir/c.o
160 ? dir/c.o
161
161
162 $ echo "relglob:*" > .hgignore
162 $ echo "relglob:*" > .hgignore
163 $ hg status
163 $ hg status
164 A dir/b.o
164 A dir/b.o
165
165
166 $ cd dir
166 $ cd dir
167 $ hg status .
167 $ hg status .
168 A b.o
168 A b.o
169
169
170 $ hg debugignore
170 $ hg debugignore
171 <includematcher includes='(?:(?:|.*/)[^/]*(?:/|$))'>
171 <includematcher includes='(?:(?:|.*/)[^/]*(?:/|$))'>
172
172
173 $ hg debugignore b.o
173 $ hg debugignore b.o
174 b.o is ignored
174 b.o is ignored
175 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob)
175 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob)
176
176
177 $ cd ..
177 $ cd ..
178
178
179 Check patterns that match only the directory
179 Check patterns that match only the directory
180
180
181 "(fsmonitor !)" below assumes that fsmonitor is enabled with
182 "walk_on_invalidate = false" (default), which doesn't involve
183 re-walking whole repository at detection of .hgignore change.
184
181 $ echo "^dir\$" > .hgignore
185 $ echo "^dir\$" > .hgignore
182 $ hg status
186 $ hg status
183 A dir/b.o
187 A dir/b.o
184 ? .hgignore
188 ? .hgignore
185 ? a.c
189 ? a.c
186 ? a.o
190 ? a.o
191 ? dir/c.o (fsmonitor !)
187 ? syntax
192 ? syntax
188
193
189 Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o)
194 Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o)
190
195
191 $ echo "syntax: glob" > .hgignore
196 $ echo "syntax: glob" > .hgignore
192 $ echo "dir/**/c.o" >> .hgignore
197 $ echo "dir/**/c.o" >> .hgignore
193 $ touch dir/c.o
198 $ touch dir/c.o
194 $ mkdir dir/subdir
199 $ mkdir dir/subdir
195 $ touch dir/subdir/c.o
200 $ touch dir/subdir/c.o
196 $ hg status
201 $ hg status
197 A dir/b.o
202 A dir/b.o
198 ? .hgignore
203 ? .hgignore
199 ? a.c
204 ? a.c
200 ? a.o
205 ? a.o
201 ? syntax
206 ? syntax
202 $ hg debugignore a.c
207 $ hg debugignore a.c
203 a.c is not ignored
208 a.c is not ignored
204 $ hg debugignore dir/c.o
209 $ hg debugignore dir/c.o
205 dir/c.o is ignored
210 dir/c.o is ignored
206 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
211 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o') (glob)
207
212
208 Check using 'include:' in ignore file
213 Check using 'include:' in ignore file
209
214
210 $ hg purge --all --config extensions.purge=
215 $ hg purge --all --config extensions.purge=
211 $ touch foo.included
216 $ touch foo.included
212
217
213 $ echo ".*.included" > otherignore
218 $ echo ".*.included" > otherignore
214 $ hg status -I "include:otherignore"
219 $ hg status -I "include:otherignore"
215 ? foo.included
220 ? foo.included
216
221
217 $ echo "include:otherignore" >> .hgignore
222 $ echo "include:otherignore" >> .hgignore
218 $ hg status
223 $ hg status
219 A dir/b.o
224 A dir/b.o
220 ? .hgignore
225 ? .hgignore
221 ? otherignore
226 ? otherignore
222
227
223 Check recursive uses of 'include:'
228 Check recursive uses of 'include:'
224
229
225 $ echo "include:nested/ignore" >> otherignore
230 $ echo "include:nested/ignore" >> otherignore
226 $ mkdir nested
231 $ mkdir nested
227 $ echo "glob:*ignore" > nested/ignore
232 $ echo "glob:*ignore" > nested/ignore
228 $ hg status
233 $ hg status
229 A dir/b.o
234 A dir/b.o
230
235
231 $ cp otherignore goodignore
236 $ cp otherignore goodignore
232 $ echo "include:badignore" >> otherignore
237 $ echo "include:badignore" >> otherignore
233 $ hg status
238 $ hg status
234 skipping unreadable pattern file 'badignore': No such file or directory
239 skipping unreadable pattern file 'badignore': No such file or directory
235 A dir/b.o
240 A dir/b.o
236
241
237 $ mv goodignore otherignore
242 $ mv goodignore otherignore
238
243
239 Check using 'include:' while in a non-root directory
244 Check using 'include:' while in a non-root directory
240
245
241 $ cd ..
246 $ cd ..
242 $ hg -R ignorerepo status
247 $ hg -R ignorerepo status
243 A dir/b.o
248 A dir/b.o
244 $ cd ignorerepo
249 $ cd ignorerepo
245
250
246 Check including subincludes
251 Check including subincludes
247
252
248 $ hg revert -q --all
253 $ hg revert -q --all
249 $ hg purge --all --config extensions.purge=
254 $ hg purge --all --config extensions.purge=
250 $ echo ".hgignore" > .hgignore
255 $ echo ".hgignore" > .hgignore
251 $ mkdir dir1 dir2
256 $ mkdir dir1 dir2
252 $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
257 $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
253 $ echo "subinclude:dir2/.hgignore" >> .hgignore
258 $ echo "subinclude:dir2/.hgignore" >> .hgignore
254 $ echo "glob:file*2" > dir2/.hgignore
259 $ echo "glob:file*2" > dir2/.hgignore
255 $ hg status
260 $ hg status
256 ? dir1/file1
261 ? dir1/file1
257 ? dir1/file2
262 ? dir1/file2
258 ? dir2/file1
263 ? dir2/file1
259
264
260 Check including subincludes with regexs
265 Check including subincludes with regexs
261
266
262 $ echo "subinclude:dir1/.hgignore" >> .hgignore
267 $ echo "subinclude:dir1/.hgignore" >> .hgignore
263 $ echo "regexp:f.le1" > dir1/.hgignore
268 $ echo "regexp:f.le1" > dir1/.hgignore
264
269
265 $ hg status
270 $ hg status
266 ? dir1/file2
271 ? dir1/file2
267 ? dir2/file1
272 ? dir2/file1
268
273
269 Check multiple levels of sub-ignores
274 Check multiple levels of sub-ignores
270
275
271 $ mkdir dir1/subdir
276 $ mkdir dir1/subdir
272 $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4
277 $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4
273 $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore
278 $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore
274 $ echo "glob:subfil*3" >> dir1/subdir/.hgignore
279 $ echo "glob:subfil*3" >> dir1/subdir/.hgignore
275
280
276 $ hg status
281 $ hg status
277 ? dir1/file2
282 ? dir1/file2
278 ? dir1/subdir/subfile4
283 ? dir1/subdir/subfile4
279 ? dir2/file1
284 ? dir2/file1
280
285
281 Check include subignore at the same level
286 Check include subignore at the same level
282
287
283 $ mv dir1/subdir/.hgignore dir1/.hgignoretwo
288 $ mv dir1/subdir/.hgignore dir1/.hgignoretwo
284 $ echo "regexp:f.le1" > dir1/.hgignore
289 $ echo "regexp:f.le1" > dir1/.hgignore
285 $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore
290 $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore
286 $ echo "glob:file*2" > dir1/.hgignoretwo
291 $ echo "glob:file*2" > dir1/.hgignoretwo
287
292
288 $ hg status | grep file2
293 $ hg status | grep file2
289 [1]
294 [1]
290 $ hg debugignore dir1/file2
295 $ hg debugignore dir1/file2
291 dir1/file2 is ignored
296 dir1/file2 is ignored
292 (ignore rule in dir2/.hgignore, line 1: 'file*2')
297 (ignore rule in dir2/.hgignore, line 1: 'file*2')
293
298
294 #if windows
299 #if windows
295
300
296 Windows paths are accepted on input
301 Windows paths are accepted on input
297
302
298 $ rm dir1/.hgignore
303 $ rm dir1/.hgignore
299 $ echo "dir1/file*" >> .hgignore
304 $ echo "dir1/file*" >> .hgignore
300 $ hg debugignore "dir1\file2"
305 $ hg debugignore "dir1\file2"
301 dir1\file2 is ignored
306 dir1\file2 is ignored
302 (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*')
307 (ignore rule in $TESTTMP\ignorerepo\.hgignore, line 4: 'dir1/file*')
303 $ hg up -qC .
308 $ hg up -qC .
304
309
305 #endif
310 #endif
General Comments 0
You need to be logged in to leave comments. Login now