##// END OF EJS Templates
debugignore: find out why a file is being ignored (issue4856)...
Laurent Charignon -
r27672:f2da9bb8 default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,285 +1,288 b''
1 $ hg init ignorerepo
1 $ hg init ignorerepo
2 $ cd ignorerepo
2 $ cd ignorerepo
3
3
4 Issue562: .hgignore requires newline at end:
4 Issue562: .hgignore requires newline at end:
5
5
6 $ touch foo
6 $ touch foo
7 $ touch bar
7 $ touch bar
8 $ touch baz
8 $ touch baz
9 $ cat > makeignore.py <<EOF
9 $ cat > makeignore.py <<EOF
10 > f = open(".hgignore", "w")
10 > f = open(".hgignore", "w")
11 > f.write("ignore\n")
11 > f.write("ignore\n")
12 > f.write("foo\n")
12 > f.write("foo\n")
13 > # No EOL here
13 > # No EOL here
14 > f.write("bar")
14 > f.write("bar")
15 > f.close()
15 > f.close()
16 > EOF
16 > EOF
17
17
18 $ python makeignore.py
18 $ python makeignore.py
19
19
20 Should display baz only:
20 Should display baz only:
21
21
22 $ hg status
22 $ hg status
23 ? baz
23 ? baz
24
24
25 $ rm foo bar baz .hgignore makeignore.py
25 $ rm foo bar baz .hgignore makeignore.py
26
26
27 $ touch a.o
27 $ touch a.o
28 $ touch a.c
28 $ touch a.c
29 $ touch syntax
29 $ touch syntax
30 $ mkdir dir
30 $ mkdir dir
31 $ touch dir/a.o
31 $ touch dir/a.o
32 $ touch dir/b.o
32 $ touch dir/b.o
33 $ touch dir/c.o
33 $ touch dir/c.o
34
34
35 $ hg add dir/a.o
35 $ hg add dir/a.o
36 $ hg commit -m 0
36 $ hg commit -m 0
37 $ hg add dir/b.o
37 $ hg add dir/b.o
38
38
39 $ hg status
39 $ hg status
40 A dir/b.o
40 A dir/b.o
41 ? a.c
41 ? a.c
42 ? a.o
42 ? a.o
43 ? dir/c.o
43 ? dir/c.o
44 ? syntax
44 ? syntax
45
45
46 $ echo "*.o" > .hgignore
46 $ echo "*.o" > .hgignore
47 $ hg status
47 $ hg status
48 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
48 abort: $TESTTMP/ignorerepo/.hgignore: invalid pattern (relre): *.o (glob)
49 [255]
49 [255]
50
50
51 $ echo ".*\.o" > .hgignore
51 $ echo ".*\.o" > .hgignore
52 $ hg status
52 $ hg status
53 A dir/b.o
53 A dir/b.o
54 ? .hgignore
54 ? .hgignore
55 ? a.c
55 ? a.c
56 ? syntax
56 ? syntax
57
57
58 Ensure that comments work:
58 Ensure that comments work:
59
59
60 $ touch 'foo#bar' 'quux#'
60 $ touch 'foo#bar' 'quux#'
61 #if no-windows
61 #if no-windows
62 $ touch 'baz\#wat'
62 $ touch 'baz\#wat'
63 #endif
63 #endif
64 $ cat <<'EOF' >> .hgignore
64 $ cat <<'EOF' >> .hgignore
65 > # full-line comment
65 > # full-line comment
66 > # whitespace-only comment line
66 > # whitespace-only comment line
67 > syntax# pattern, no whitespace, then comment
67 > syntax# pattern, no whitespace, then comment
68 > a.c # pattern, then whitespace, then comment
68 > a.c # pattern, then whitespace, then comment
69 > baz\\# # escaped comment character
69 > baz\\# # escaped comment character
70 > foo\#b # escaped comment character
70 > foo\#b # escaped comment character
71 > quux\## escaped comment character at end of name
71 > quux\## escaped comment character at end of name
72 > EOF
72 > EOF
73 $ hg status
73 $ hg status
74 A dir/b.o
74 A dir/b.o
75 ? .hgignore
75 ? .hgignore
76 $ rm 'foo#bar' 'quux#'
76 $ rm 'foo#bar' 'quux#'
77 #if no-windows
77 #if no-windows
78 $ rm 'baz\#wat'
78 $ rm 'baz\#wat'
79 #endif
79 #endif
80
80
81 Check it does not ignore the current directory '.':
81 Check it does not ignore the current directory '.':
82
82
83 $ echo "^\." > .hgignore
83 $ echo "^\." > .hgignore
84 $ hg status
84 $ hg status
85 A dir/b.o
85 A dir/b.o
86 ? a.c
86 ? a.c
87 ? a.o
87 ? a.o
88 ? dir/c.o
88 ? dir/c.o
89 ? syntax
89 ? syntax
90
90
91 Test that patterns from ui.ignore options are read:
91 Test that patterns from ui.ignore options are read:
92
92
93 $ echo > .hgignore
93 $ echo > .hgignore
94 $ cat >> $HGRCPATH << EOF
94 $ cat >> $HGRCPATH << EOF
95 > [ui]
95 > [ui]
96 > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore
96 > ignore.other = $TESTTMP/ignorerepo/.hg/testhgignore
97 > EOF
97 > EOF
98 $ echo "glob:**.o" > .hg/testhgignore
98 $ echo "glob:**.o" > .hg/testhgignore
99 $ hg status
99 $ hg status
100 A dir/b.o
100 A dir/b.o
101 ? .hgignore
101 ? .hgignore
102 ? a.c
102 ? a.c
103 ? syntax
103 ? syntax
104
104
105 empty out testhgignore
105 empty out testhgignore
106 $ echo > .hg/testhgignore
106 $ echo > .hg/testhgignore
107
107
108 Test relative ignore path (issue4473):
108 Test relative ignore path (issue4473):
109
109
110 $ cat >> $HGRCPATH << EOF
110 $ cat >> $HGRCPATH << EOF
111 > [ui]
111 > [ui]
112 > ignore.relative = .hg/testhgignorerel
112 > ignore.relative = .hg/testhgignorerel
113 > EOF
113 > EOF
114 $ echo "glob:*.o" > .hg/testhgignorerel
114 $ echo "glob:*.o" > .hg/testhgignorerel
115 $ cd dir
115 $ cd dir
116 $ hg status
116 $ hg status
117 A dir/b.o
117 A dir/b.o
118 ? .hgignore
118 ? .hgignore
119 ? a.c
119 ? a.c
120 ? syntax
120 ? syntax
121
121
122 $ cd ..
122 $ cd ..
123 $ echo > .hg/testhgignorerel
123 $ echo > .hg/testhgignorerel
124 $ echo "syntax: glob" > .hgignore
124 $ echo "syntax: glob" > .hgignore
125 $ echo "re:.*\.o" >> .hgignore
125 $ echo "re:.*\.o" >> .hgignore
126 $ hg status
126 $ hg status
127 A dir/b.o
127 A dir/b.o
128 ? .hgignore
128 ? .hgignore
129 ? a.c
129 ? a.c
130 ? syntax
130 ? syntax
131
131
132 $ echo "syntax: invalid" > .hgignore
132 $ echo "syntax: invalid" > .hgignore
133 $ hg status
133 $ hg status
134 $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' (glob)
134 $TESTTMP/ignorerepo/.hgignore: ignoring invalid syntax 'invalid' (glob)
135 A dir/b.o
135 A dir/b.o
136 ? .hgignore
136 ? .hgignore
137 ? a.c
137 ? a.c
138 ? a.o
138 ? a.o
139 ? dir/c.o
139 ? dir/c.o
140 ? syntax
140 ? syntax
141
141
142 $ echo "syntax: glob" > .hgignore
142 $ echo "syntax: glob" > .hgignore
143 $ echo "*.o" >> .hgignore
143 $ echo "*.o" >> .hgignore
144 $ hg status
144 $ hg status
145 A dir/b.o
145 A dir/b.o
146 ? .hgignore
146 ? .hgignore
147 ? a.c
147 ? a.c
148 ? syntax
148 ? syntax
149
149
150 $ echo "relglob:syntax*" > .hgignore
150 $ echo "relglob:syntax*" > .hgignore
151 $ hg status
151 $ hg status
152 A dir/b.o
152 A dir/b.o
153 ? .hgignore
153 ? .hgignore
154 ? a.c
154 ? a.c
155 ? a.o
155 ? a.o
156 ? dir/c.o
156 ? dir/c.o
157
157
158 $ echo "relglob:*" > .hgignore
158 $ echo "relglob:*" > .hgignore
159 $ hg status
159 $ hg status
160 A dir/b.o
160 A dir/b.o
161
161
162 $ cd dir
162 $ cd dir
163 $ hg status .
163 $ hg status .
164 A b.o
164 A b.o
165
165
166 $ hg debugignore
166 $ hg debugignore
167 (?:(?:|.*/)[^/]*(?:/|$))
167 (?:(?:|.*/)[^/]*(?:/|$))
168
168
169 $ hg debugignore b.o
169 $ hg debugignore b.o
170 b.o is ignored
170 b.o is ignored
171 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*')
171
172
172 $ cd ..
173 $ cd ..
173
174
174 Check patterns that match only the directory
175 Check patterns that match only the directory
175
176
176 $ echo "^dir\$" > .hgignore
177 $ echo "^dir\$" > .hgignore
177 $ hg status
178 $ hg status
178 A dir/b.o
179 A dir/b.o
179 ? .hgignore
180 ? .hgignore
180 ? a.c
181 ? a.c
181 ? a.o
182 ? a.o
182 ? syntax
183 ? syntax
183
184
184 Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o)
185 Check recursive glob pattern matches no directories (dir/**/c.o matches dir/c.o)
185
186
186 $ echo "syntax: glob" > .hgignore
187 $ echo "syntax: glob" > .hgignore
187 $ echo "dir/**/c.o" >> .hgignore
188 $ echo "dir/**/c.o" >> .hgignore
188 $ touch dir/c.o
189 $ touch dir/c.o
189 $ mkdir dir/subdir
190 $ mkdir dir/subdir
190 $ touch dir/subdir/c.o
191 $ touch dir/subdir/c.o
191 $ hg status
192 $ hg status
192 A dir/b.o
193 A dir/b.o
193 ? .hgignore
194 ? .hgignore
194 ? a.c
195 ? a.c
195 ? a.o
196 ? a.o
196 ? syntax
197 ? syntax
197 $ hg debugignore a.c
198 $ hg debugignore a.c
198 a.c is not ignored
199 a.c is not ignored
199 $ hg debugignore dir/c.o
200 $ hg debugignore dir/c.o
200 dir/c.o is ignored
201 dir/c.o is ignored
202 (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 2: 'dir/**/c.o')
201
203
202 Check using 'include:' in ignore file
204 Check using 'include:' in ignore file
203
205
204 $ hg purge --all --config extensions.purge=
206 $ hg purge --all --config extensions.purge=
205 $ touch foo.included
207 $ touch foo.included
206
208
207 $ echo ".*.included" > otherignore
209 $ echo ".*.included" > otherignore
208 $ hg status -I "include:otherignore"
210 $ hg status -I "include:otherignore"
209 ? foo.included
211 ? foo.included
210
212
211 $ echo "include:otherignore" >> .hgignore
213 $ echo "include:otherignore" >> .hgignore
212 $ hg status
214 $ hg status
213 A dir/b.o
215 A dir/b.o
214 ? .hgignore
216 ? .hgignore
215 ? otherignore
217 ? otherignore
216
218
217 Check recursive uses of 'include:'
219 Check recursive uses of 'include:'
218
220
219 $ echo "include:nested/ignore" >> otherignore
221 $ echo "include:nested/ignore" >> otherignore
220 $ mkdir nested
222 $ mkdir nested
221 $ echo "glob:*ignore" > nested/ignore
223 $ echo "glob:*ignore" > nested/ignore
222 $ hg status
224 $ hg status
223 A dir/b.o
225 A dir/b.o
224
226
225 $ cp otherignore goodignore
227 $ cp otherignore goodignore
226 $ echo "include:badignore" >> otherignore
228 $ echo "include:badignore" >> otherignore
227 $ hg status
229 $ hg status
228 skipping unreadable pattern file 'badignore': No such file or directory
230 skipping unreadable pattern file 'badignore': No such file or directory
229 A dir/b.o
231 A dir/b.o
230
232
231 $ mv goodignore otherignore
233 $ mv goodignore otherignore
232
234
233 Check using 'include:' while in a non-root directory
235 Check using 'include:' while in a non-root directory
234
236
235 $ cd ..
237 $ cd ..
236 $ hg -R ignorerepo status
238 $ hg -R ignorerepo status
237 A dir/b.o
239 A dir/b.o
238 $ cd ignorerepo
240 $ cd ignorerepo
239
241
240 Check including subincludes
242 Check including subincludes
241
243
242 $ hg revert -q --all
244 $ hg revert -q --all
243 $ hg purge --all --config extensions.purge=
245 $ hg purge --all --config extensions.purge=
244 $ echo ".hgignore" > .hgignore
246 $ echo ".hgignore" > .hgignore
245 $ mkdir dir1 dir2
247 $ mkdir dir1 dir2
246 $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
248 $ touch dir1/file1 dir1/file2 dir2/file1 dir2/file2
247 $ echo "subinclude:dir2/.hgignore" >> .hgignore
249 $ echo "subinclude:dir2/.hgignore" >> .hgignore
248 $ echo "glob:file*2" > dir2/.hgignore
250 $ echo "glob:file*2" > dir2/.hgignore
249 $ hg status
251 $ hg status
250 ? dir1/file1
252 ? dir1/file1
251 ? dir1/file2
253 ? dir1/file2
252 ? dir2/file1
254 ? dir2/file1
253
255
254 Check including subincludes with regexs
256 Check including subincludes with regexs
255
257
256 $ echo "subinclude:dir1/.hgignore" >> .hgignore
258 $ echo "subinclude:dir1/.hgignore" >> .hgignore
257 $ echo "regexp:f.le1" > dir1/.hgignore
259 $ echo "regexp:f.le1" > dir1/.hgignore
258
260
259 $ hg status
261 $ hg status
260 ? dir1/file2
262 ? dir1/file2
261 ? dir2/file1
263 ? dir2/file1
262
264
263 Check multiple levels of sub-ignores
265 Check multiple levels of sub-ignores
264
266
265 $ mkdir dir1/subdir
267 $ mkdir dir1/subdir
266 $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4
268 $ touch dir1/subdir/subfile1 dir1/subdir/subfile3 dir1/subdir/subfile4
267 $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore
269 $ echo "subinclude:subdir/.hgignore" >> dir1/.hgignore
268 $ echo "glob:subfil*3" >> dir1/subdir/.hgignore
270 $ echo "glob:subfil*3" >> dir1/subdir/.hgignore
269
271
270 $ hg status
272 $ hg status
271 ? dir1/file2
273 ? dir1/file2
272 ? dir1/subdir/subfile4
274 ? dir1/subdir/subfile4
273 ? dir2/file1
275 ? dir2/file1
274
276
275 Check include subignore at the same level
277 Check include subignore at the same level
276
278
277 $ mv dir1/subdir/.hgignore dir1/.hgignoretwo
279 $ mv dir1/subdir/.hgignore dir1/.hgignoretwo
278 $ echo "regexp:f.le1" > dir1/.hgignore
280 $ echo "regexp:f.le1" > dir1/.hgignore
279 $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore
281 $ echo "subinclude:.hgignoretwo" >> dir1/.hgignore
280 $ echo "glob:file*2" > dir1/.hgignoretwo
282 $ echo "glob:file*2" > dir1/.hgignoretwo
281
283
282 $ hg status | grep file2
284 $ hg status | grep file2
283 [1]
285 [1]
284 $ hg debugignore dir1/file2
286 $ hg debugignore dir1/file2
285 dir1/file2 is ignored
287 dir1/file2 is ignored
288 (ignore rule in dir2/.hgignore, line 1: 'file*2')
General Comments 0
You need to be logged in to leave comments. Login now