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