Show More
@@ -1,1037 +1,1037 b'' | |||||
1 | $ fileset() { |
|
1 | $ fileset() { | |
2 | > hg debugfileset --all-files "$@" |
|
2 | > hg debugfileset --all-files "$@" | |
3 | > } |
|
3 | > } | |
4 |
|
4 | |||
5 | $ hg init repo |
|
5 | $ hg init repo | |
6 | $ cd repo |
|
6 | $ cd repo | |
7 | $ echo a > a1 |
|
7 | $ echo a > a1 | |
8 | $ echo a > a2 |
|
8 | $ echo a > a2 | |
9 | $ echo b > b1 |
|
9 | $ echo b > b1 | |
10 | $ echo b > b2 |
|
10 | $ echo b > b2 | |
11 | $ hg ci -Am addfiles |
|
11 | $ hg ci -Am addfiles | |
12 | adding a1 |
|
12 | adding a1 | |
13 | adding a2 |
|
13 | adding a2 | |
14 | adding b1 |
|
14 | adding b1 | |
15 | adding b2 |
|
15 | adding b2 | |
16 |
|
16 | |||
17 | Test operators and basic patterns |
|
17 | Test operators and basic patterns | |
18 |
|
18 | |||
19 | $ fileset -v a1 |
|
19 | $ fileset -v a1 | |
20 | (symbol 'a1') |
|
20 | (symbol 'a1') | |
21 | * matcher: |
|
21 | * matcher: | |
22 | <patternmatcher patterns='a1$'> |
|
22 | <patternmatcher patterns='a1$'> | |
23 | a1 |
|
23 | a1 | |
24 | $ fileset -v 'a*' |
|
24 | $ fileset -v 'a*' | |
25 | (symbol 'a*') |
|
25 | (symbol 'a*') | |
26 | * matcher: |
|
26 | * matcher: | |
27 | <patternmatcher patterns='a[^/]*$'> |
|
27 | <patternmatcher patterns='a[^/]*$'> | |
28 | a1 |
|
28 | a1 | |
29 | a2 |
|
29 | a2 | |
30 | $ fileset -v '"re:a\d"' |
|
30 | $ fileset -v '"re:a\d"' | |
31 | (string 're:a\\d') |
|
31 | (string 're:a\\d') | |
32 | * matcher: |
|
32 | * matcher: | |
33 | <patternmatcher patterns='a\\d'> |
|
33 | <patternmatcher patterns='a\\d'> | |
34 | a1 |
|
34 | a1 | |
35 | a2 |
|
35 | a2 | |
36 | $ fileset -v '!re:"a\d"' |
|
36 | $ fileset -v '!re:"a\d"' | |
37 | (not |
|
37 | (not | |
38 | (kindpat |
|
38 | (kindpat | |
39 | (symbol 're') |
|
39 | (symbol 're') | |
40 | (string 'a\\d'))) |
|
40 | (string 'a\\d'))) | |
41 | * matcher: |
|
41 | * matcher: | |
42 | <predicatenmatcher |
|
42 | <predicatenmatcher | |
43 | pred=<not |
|
43 | pred=<not | |
44 | <patternmatcher patterns='a\\d'>>> |
|
44 | <patternmatcher patterns='a\\d'>>> | |
45 | b1 |
|
45 | b1 | |
46 | b2 |
|
46 | b2 | |
47 | $ fileset -v 'path:a1 or glob:b?' |
|
47 | $ fileset -v 'path:a1 or glob:b?' | |
48 | (or |
|
48 | (or | |
49 | (kindpat |
|
49 | (kindpat | |
50 | (symbol 'path') |
|
50 | (symbol 'path') | |
51 | (symbol 'a1')) |
|
51 | (symbol 'a1')) | |
52 | (kindpat |
|
52 | (kindpat | |
53 | (symbol 'glob') |
|
53 | (symbol 'glob') | |
54 | (symbol 'b?'))) |
|
54 | (symbol 'b?'))) | |
55 | * matcher: |
|
55 | * matcher: | |
56 | <patternmatcher patterns='a1(?:/|$)|b.$'> |
|
56 | <patternmatcher patterns='a1(?:/|$)|b.$'> | |
57 | a1 |
|
57 | a1 | |
58 | b1 |
|
58 | b1 | |
59 | b2 |
|
59 | b2 | |
60 | $ fileset -v --no-show-matcher 'a1 or a2' |
|
60 | $ fileset -v --no-show-matcher 'a1 or a2' | |
61 | (or |
|
61 | (or | |
62 | (symbol 'a1') |
|
62 | (symbol 'a1') | |
63 | (symbol 'a2')) |
|
63 | (symbol 'a2')) | |
64 | a1 |
|
64 | a1 | |
65 | a2 |
|
65 | a2 | |
66 | $ fileset 'a1 | a2' |
|
66 | $ fileset 'a1 | a2' | |
67 | a1 |
|
67 | a1 | |
68 | a2 |
|
68 | a2 | |
69 | $ fileset 'a* and "*1"' |
|
69 | $ fileset 'a* and "*1"' | |
70 | a1 |
|
70 | a1 | |
71 | $ fileset 'a* & "*1"' |
|
71 | $ fileset 'a* & "*1"' | |
72 | a1 |
|
72 | a1 | |
73 | $ fileset 'not (r"a*")' |
|
73 | $ fileset 'not (r"a*")' | |
74 | b1 |
|
74 | b1 | |
75 | b2 |
|
75 | b2 | |
76 | $ fileset '! ("a*")' |
|
76 | $ fileset '! ("a*")' | |
77 | b1 |
|
77 | b1 | |
78 | b2 |
|
78 | b2 | |
79 | $ fileset 'a* - a1' |
|
79 | $ fileset 'a* - a1' | |
80 | a2 |
|
80 | a2 | |
81 | $ fileset 'a_b' |
|
81 | $ fileset 'a_b' | |
82 | $ fileset '"\xy"' |
|
82 | $ fileset '"\xy"' | |
83 | hg: parse error: invalid \x escape* (glob) |
|
83 | hg: parse error: invalid \x escape* (glob) | |
84 | [255] |
|
84 | [255] | |
85 |
|
85 | |||
86 | Test invalid syntax |
|
86 | Test invalid syntax | |
87 |
|
87 | |||
88 | $ fileset -v '"added"()' |
|
88 | $ fileset -v '"added"()' | |
89 | (func |
|
89 | (func | |
90 | (string 'added') |
|
90 | (string 'added') | |
91 | None) |
|
91 | None) | |
92 | hg: parse error: not a symbol |
|
92 | hg: parse error: not a symbol | |
93 | [255] |
|
93 | [255] | |
94 | $ fileset -v '()()' |
|
94 | $ fileset -v '()()' | |
95 | (func |
|
95 | (func | |
96 | (group |
|
96 | (group | |
97 | None) |
|
97 | None) | |
98 | None) |
|
98 | None) | |
99 | hg: parse error: not a symbol |
|
99 | hg: parse error: not a symbol | |
100 | [255] |
|
100 | [255] | |
101 | $ fileset -v -- '-x' |
|
101 | $ fileset -v -- '-x' | |
102 | (negate |
|
102 | (negate | |
103 | (symbol 'x')) |
|
103 | (symbol 'x')) | |
104 | hg: parse error: can't use negate operator in this context |
|
104 | hg: parse error: can't use negate operator in this context | |
105 | [255] |
|
105 | [255] | |
106 | $ fileset -v -- '-()' |
|
106 | $ fileset -v -- '-()' | |
107 | (negate |
|
107 | (negate | |
108 | (group |
|
108 | (group | |
109 | None)) |
|
109 | None)) | |
110 | hg: parse error: can't use negate operator in this context |
|
110 | hg: parse error: can't use negate operator in this context | |
111 | [255] |
|
111 | [255] | |
112 | $ fileset -p parsed 'a, b, c' |
|
112 | $ fileset -p parsed 'a, b, c' | |
113 | * parsed: |
|
113 | * parsed: | |
114 | (list |
|
114 | (list | |
115 | (symbol 'a') |
|
115 | (symbol 'a') | |
116 | (symbol 'b') |
|
116 | (symbol 'b') | |
117 | (symbol 'c')) |
|
117 | (symbol 'c')) | |
118 | hg: parse error: can't use a list in this context |
|
118 | hg: parse error: can't use a list in this context | |
119 | (see 'hg help "filesets.x or y"') |
|
119 | (see 'hg help "filesets.x or y"') | |
120 | [255] |
|
120 | [255] | |
121 |
|
121 | |||
122 | $ fileset '"path":.' |
|
122 | $ fileset '"path":.' | |
123 | hg: parse error: not a symbol |
|
123 | hg: parse error: not a symbol | |
124 | [255] |
|
124 | [255] | |
125 | $ fileset 'path:foo bar' |
|
125 | $ fileset 'path:foo bar' | |
126 | hg: parse error at 9: invalid token |
|
126 | hg: parse error at 9: invalid token | |
127 | [255] |
|
127 | [255] | |
128 | $ fileset 'foo:bar:baz' |
|
128 | $ fileset 'foo:bar:baz' | |
129 | hg: parse error: not a symbol |
|
129 | hg: parse error: not a symbol | |
130 | [255] |
|
130 | [255] | |
131 | $ fileset 'foo:bar()' |
|
131 | $ fileset 'foo:bar()' | |
132 | hg: parse error: pattern must be a string |
|
132 | hg: parse error: pattern must be a string | |
133 | [255] |
|
133 | [255] | |
134 | $ fileset 'foo:bar' |
|
134 | $ fileset 'foo:bar' | |
135 | hg: parse error: invalid pattern kind: foo |
|
135 | hg: parse error: invalid pattern kind: foo | |
136 | [255] |
|
136 | [255] | |
137 |
|
137 | |||
138 | Show parsed tree at stages: |
|
138 | Show parsed tree at stages: | |
139 |
|
139 | |||
140 | $ fileset -p unknown a |
|
140 | $ fileset -p unknown a | |
141 | abort: invalid stage name: unknown |
|
141 | abort: invalid stage name: unknown | |
142 | [255] |
|
142 | [255] | |
143 |
|
143 | |||
144 | $ fileset -p parsed 'path:a1 or glob:b?' |
|
144 | $ fileset -p parsed 'path:a1 or glob:b?' | |
145 | * parsed: |
|
145 | * parsed: | |
146 | (or |
|
146 | (or | |
147 | (kindpat |
|
147 | (kindpat | |
148 | (symbol 'path') |
|
148 | (symbol 'path') | |
149 | (symbol 'a1')) |
|
149 | (symbol 'a1')) | |
150 | (kindpat |
|
150 | (kindpat | |
151 | (symbol 'glob') |
|
151 | (symbol 'glob') | |
152 | (symbol 'b?'))) |
|
152 | (symbol 'b?'))) | |
153 | a1 |
|
153 | a1 | |
154 | b1 |
|
154 | b1 | |
155 | b2 |
|
155 | b2 | |
156 |
|
156 | |||
157 | $ fileset -p all -s 'a1 or a2 or (grep("b") & clean())' |
|
157 | $ fileset -p all -s 'a1 or a2 or (grep("b") & clean())' | |
158 | * parsed: |
|
158 | * parsed: | |
159 | (or |
|
159 | (or | |
160 | (symbol 'a1') |
|
160 | (symbol 'a1') | |
161 | (symbol 'a2') |
|
161 | (symbol 'a2') | |
162 | (group |
|
162 | (group | |
163 | (and |
|
163 | (and | |
164 | (func |
|
164 | (func | |
165 | (symbol 'grep') |
|
165 | (symbol 'grep') | |
166 | (string 'b')) |
|
166 | (string 'b')) | |
167 | (func |
|
167 | (func | |
168 | (symbol 'clean') |
|
168 | (symbol 'clean') | |
169 | None)))) |
|
169 | None)))) | |
170 | * analyzed: |
|
170 | * analyzed: | |
171 | (or |
|
171 | (or | |
172 | (symbol 'a1') |
|
172 | (symbol 'a1') | |
173 | (symbol 'a2') |
|
173 | (symbol 'a2') | |
174 | (and |
|
174 | (and | |
175 | (func |
|
175 | (func | |
176 | (symbol 'grep') |
|
176 | (symbol 'grep') | |
177 | (string 'b')) |
|
177 | (string 'b')) | |
178 | (withstatus |
|
178 | (withstatus | |
179 | (func |
|
179 | (func | |
180 | (symbol 'clean') |
|
180 | (symbol 'clean') | |
181 | None) |
|
181 | None) | |
182 | (string 'clean')))) |
|
182 | (string 'clean')))) | |
183 | * optimized: |
|
183 | * optimized: | |
184 | (or |
|
184 | (or | |
185 | (patterns |
|
185 | (patterns | |
186 | (symbol 'a1') |
|
186 | (symbol 'a1') | |
187 | (symbol 'a2')) |
|
187 | (symbol 'a2')) | |
188 | (and |
|
188 | (and | |
189 | (withstatus |
|
189 | (withstatus | |
190 | (func |
|
190 | (func | |
191 | (symbol 'clean') |
|
191 | (symbol 'clean') | |
192 | None) |
|
192 | None) | |
193 | (string 'clean')) |
|
193 | (string 'clean')) | |
194 | (func |
|
194 | (func | |
195 | (symbol 'grep') |
|
195 | (symbol 'grep') | |
196 | (string 'b')))) |
|
196 | (string 'b')))) | |
197 | * matcher: |
|
197 | * matcher: | |
198 | <unionmatcher matchers=[ |
|
198 | <unionmatcher matchers=[ | |
199 | <patternmatcher patterns='a1$|a2$'>, |
|
199 | <patternmatcher patterns='a1$|a2$'>, | |
200 | <intersectionmatcher |
|
200 | <intersectionmatcher | |
201 | m1=<predicatenmatcher pred=clean>, |
|
201 | m1=<predicatenmatcher pred=clean>, | |
202 | m2=<predicatenmatcher pred=grep('b')>>]> |
|
202 | m2=<predicatenmatcher pred=grep('b')>>]> | |
203 | a1 |
|
203 | a1 | |
204 | a2 |
|
204 | a2 | |
205 | b1 |
|
205 | b1 | |
206 | b2 |
|
206 | b2 | |
207 |
|
207 | |||
208 | Union of basic patterns: |
|
208 | Union of basic patterns: | |
209 |
|
209 | |||
210 | $ fileset -p optimized -s -r. 'a1 or a2 or path:b1' |
|
210 | $ fileset -p optimized -s -r. 'a1 or a2 or path:b1' | |
211 | * optimized: |
|
211 | * optimized: | |
212 | (patterns |
|
212 | (patterns | |
213 | (symbol 'a1') |
|
213 | (symbol 'a1') | |
214 | (symbol 'a2') |
|
214 | (symbol 'a2') | |
215 | (kindpat |
|
215 | (kindpat | |
216 | (symbol 'path') |
|
216 | (symbol 'path') | |
217 | (symbol 'b1'))) |
|
217 | (symbol 'b1'))) | |
218 | * matcher: |
|
218 | * matcher: | |
219 | <patternmatcher patterns='a1$|a2$|b1(?:/|$)'> |
|
219 | <patternmatcher patterns='a1$|a2$|b1(?:/|$)'> | |
220 | a1 |
|
220 | a1 | |
221 | a2 |
|
221 | a2 | |
222 | b1 |
|
222 | b1 | |
223 |
|
223 | |||
224 | OR expression should be reordered by weight: |
|
224 | OR expression should be reordered by weight: | |
225 |
|
225 | |||
226 | $ fileset -p optimized -s -r. 'grep("a") or a1 or grep("b") or b2' |
|
226 | $ fileset -p optimized -s -r. 'grep("a") or a1 or grep("b") or b2' | |
227 | * optimized: |
|
227 | * optimized: | |
228 | (or |
|
228 | (or | |
229 | (patterns |
|
229 | (patterns | |
230 | (symbol 'a1') |
|
230 | (symbol 'a1') | |
231 | (symbol 'b2')) |
|
231 | (symbol 'b2')) | |
232 | (func |
|
232 | (func | |
233 | (symbol 'grep') |
|
233 | (symbol 'grep') | |
234 | (string 'a')) |
|
234 | (string 'a')) | |
235 | (func |
|
235 | (func | |
236 | (symbol 'grep') |
|
236 | (symbol 'grep') | |
237 | (string 'b'))) |
|
237 | (string 'b'))) | |
238 | * matcher: |
|
238 | * matcher: | |
239 | <unionmatcher matchers=[ |
|
239 | <unionmatcher matchers=[ | |
240 | <patternmatcher patterns='a1$|b2$'>, |
|
240 | <patternmatcher patterns='a1$|b2$'>, | |
241 | <predicatenmatcher pred=grep('a')>, |
|
241 | <predicatenmatcher pred=grep('a')>, | |
242 | <predicatenmatcher pred=grep('b')>]> |
|
242 | <predicatenmatcher pred=grep('b')>]> | |
243 | a1 |
|
243 | a1 | |
244 | a2 |
|
244 | a2 | |
245 | b1 |
|
245 | b1 | |
246 | b2 |
|
246 | b2 | |
247 |
|
247 | |||
248 | Use differencematcher for 'x and not y': |
|
248 | Use differencematcher for 'x and not y': | |
249 |
|
249 | |||
250 | $ fileset -p optimized -s 'a* and not a1' |
|
250 | $ fileset -p optimized -s 'a* and not a1' | |
251 | * optimized: |
|
251 | * optimized: | |
252 | (minus |
|
252 | (minus | |
253 | (symbol 'a*') |
|
253 | (symbol 'a*') | |
254 | (symbol 'a1')) |
|
254 | (symbol 'a1')) | |
255 | * matcher: |
|
255 | * matcher: | |
256 | <differencematcher |
|
256 | <differencematcher | |
257 | m1=<patternmatcher patterns='a[^/]*$'>, |
|
257 | m1=<patternmatcher patterns='a[^/]*$'>, | |
258 | m2=<patternmatcher patterns='a1$'>> |
|
258 | m2=<patternmatcher patterns='a1$'>> | |
259 | a2 |
|
259 | a2 | |
260 |
|
260 | |||
261 | $ fileset -p optimized -s '!binary() and a*' |
|
261 | $ fileset -p optimized -s '!binary() and a*' | |
262 | * optimized: |
|
262 | * optimized: | |
263 | (minus |
|
263 | (minus | |
264 | (symbol 'a*') |
|
264 | (symbol 'a*') | |
265 | (func |
|
265 | (func | |
266 | (symbol 'binary') |
|
266 | (symbol 'binary') | |
267 | None)) |
|
267 | None)) | |
268 | * matcher: |
|
268 | * matcher: | |
269 | <differencematcher |
|
269 | <differencematcher | |
270 | m1=<patternmatcher patterns='a[^/]*$'>, |
|
270 | m1=<patternmatcher patterns='a[^/]*$'>, | |
271 | m2=<predicatenmatcher pred=binary>> |
|
271 | m2=<predicatenmatcher pred=binary>> | |
272 | a1 |
|
272 | a1 | |
273 | a2 |
|
273 | a2 | |
274 |
|
274 | |||
275 | 'x - y' is rewritten to 'x and not y' first so the operands can be reordered: |
|
275 | 'x - y' is rewritten to 'x and not y' first so the operands can be reordered: | |
276 |
|
276 | |||
277 | $ fileset -p analyzed -p optimized -s 'a* - a1' |
|
277 | $ fileset -p analyzed -p optimized -s 'a* - a1' | |
278 | * analyzed: |
|
278 | * analyzed: | |
279 | (and |
|
279 | (and | |
280 | (symbol 'a*') |
|
280 | (symbol 'a*') | |
281 | (not |
|
281 | (not | |
282 | (symbol 'a1'))) |
|
282 | (symbol 'a1'))) | |
283 | * optimized: |
|
283 | * optimized: | |
284 | (minus |
|
284 | (minus | |
285 | (symbol 'a*') |
|
285 | (symbol 'a*') | |
286 | (symbol 'a1')) |
|
286 | (symbol 'a1')) | |
287 | * matcher: |
|
287 | * matcher: | |
288 | <differencematcher |
|
288 | <differencematcher | |
289 | m1=<patternmatcher patterns='a[^/]*$'>, |
|
289 | m1=<patternmatcher patterns='a[^/]*$'>, | |
290 | m2=<patternmatcher patterns='a1$'>> |
|
290 | m2=<patternmatcher patterns='a1$'>> | |
291 | a2 |
|
291 | a2 | |
292 |
|
292 | |||
293 | $ fileset -p analyzed -p optimized -s 'binary() - a*' |
|
293 | $ fileset -p analyzed -p optimized -s 'binary() - a*' | |
294 | * analyzed: |
|
294 | * analyzed: | |
295 | (and |
|
295 | (and | |
296 | (func |
|
296 | (func | |
297 | (symbol 'binary') |
|
297 | (symbol 'binary') | |
298 | None) |
|
298 | None) | |
299 | (not |
|
299 | (not | |
300 | (symbol 'a*'))) |
|
300 | (symbol 'a*'))) | |
301 | * optimized: |
|
301 | * optimized: | |
302 | (and |
|
302 | (and | |
303 | (not |
|
303 | (not | |
304 | (symbol 'a*')) |
|
304 | (symbol 'a*')) | |
305 | (func |
|
305 | (func | |
306 | (symbol 'binary') |
|
306 | (symbol 'binary') | |
307 | None)) |
|
307 | None)) | |
308 | * matcher: |
|
308 | * matcher: | |
309 | <intersectionmatcher |
|
309 | <intersectionmatcher | |
310 | m1=<predicatenmatcher |
|
310 | m1=<predicatenmatcher | |
311 | pred=<not |
|
311 | pred=<not | |
312 | <patternmatcher patterns='a[^/]*$'>>>, |
|
312 | <patternmatcher patterns='a[^/]*$'>>>, | |
313 | m2=<predicatenmatcher pred=binary>> |
|
313 | m2=<predicatenmatcher pred=binary>> | |
314 |
|
314 | |||
315 | Test files status |
|
315 | Test files status | |
316 |
|
316 | |||
317 | $ rm a1 |
|
317 | $ rm a1 | |
318 | $ hg rm a2 |
|
318 | $ hg rm a2 | |
319 | $ echo b >> b2 |
|
319 | $ echo b >> b2 | |
320 | $ hg cp b1 c1 |
|
320 | $ hg cp b1 c1 | |
321 | $ echo c > c2 |
|
321 | $ echo c > c2 | |
322 | $ echo c > c3 |
|
322 | $ echo c > c3 | |
323 | $ cat > .hgignore <<EOF |
|
323 | $ cat > .hgignore <<EOF | |
324 | > \.hgignore |
|
324 | > \.hgignore | |
325 | > 2$ |
|
325 | > 2$ | |
326 | > EOF |
|
326 | > EOF | |
327 | $ fileset 'modified()' |
|
327 | $ fileset 'modified()' | |
328 | b2 |
|
328 | b2 | |
329 | $ fileset 'added()' |
|
329 | $ fileset 'added()' | |
330 | c1 |
|
330 | c1 | |
331 | $ fileset 'removed()' |
|
331 | $ fileset 'removed()' | |
332 | a2 |
|
332 | a2 | |
333 | $ fileset 'deleted()' |
|
333 | $ fileset 'deleted()' | |
334 | a1 |
|
334 | a1 | |
335 | $ fileset 'missing()' |
|
335 | $ fileset 'missing()' | |
336 | a1 |
|
336 | a1 | |
337 | $ fileset 'unknown()' |
|
337 | $ fileset 'unknown()' | |
338 | c3 |
|
338 | c3 | |
339 | $ fileset 'ignored()' |
|
339 | $ fileset 'ignored()' | |
340 | .hgignore |
|
340 | .hgignore | |
341 | c2 |
|
341 | c2 | |
342 | $ fileset 'hgignore()' |
|
342 | $ fileset 'hgignore()' | |
343 | .hgignore |
|
343 | .hgignore | |
344 | a2 |
|
344 | a2 | |
345 | b2 |
|
345 | b2 | |
346 | c2 |
|
346 | c2 | |
347 | $ fileset 'clean()' |
|
347 | $ fileset 'clean()' | |
348 | b1 |
|
348 | b1 | |
349 | $ fileset 'copied()' |
|
349 | $ fileset 'copied()' | |
350 | c1 |
|
350 | c1 | |
351 |
|
351 | |||
352 | Test files status in different revisions |
|
352 | Test files status in different revisions | |
353 |
|
353 | |||
354 | $ hg status -m |
|
354 | $ hg status -m | |
355 | M b2 |
|
355 | M b2 | |
356 | $ fileset -r0 'revs("wdir()", modified())' --traceback |
|
356 | $ fileset -r0 'revs("wdir()", modified())' --traceback | |
357 | b2 |
|
357 | b2 | |
358 | $ hg status -a |
|
358 | $ hg status -a | |
359 | A c1 |
|
359 | A c1 | |
360 | $ fileset -r0 'revs("wdir()", added())' |
|
360 | $ fileset -r0 'revs("wdir()", added())' | |
361 | c1 |
|
361 | c1 | |
362 | $ hg status --change 0 -a |
|
362 | $ hg status --change 0 -a | |
363 | A a1 |
|
363 | A a1 | |
364 | A a2 |
|
364 | A a2 | |
365 | A b1 |
|
365 | A b1 | |
366 | A b2 |
|
366 | A b2 | |
367 | $ hg status -mru |
|
367 | $ hg status -mru | |
368 | M b2 |
|
368 | M b2 | |
369 | R a2 |
|
369 | R a2 | |
370 | ? c3 |
|
370 | ? c3 | |
371 | $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())' |
|
371 | $ fileset -r0 'added() and revs("wdir()", modified() or removed() or unknown())' | |
372 | a2 |
|
372 | a2 | |
373 | b2 |
|
373 | b2 | |
374 | $ fileset -r0 'added() or revs("wdir()", added())' |
|
374 | $ fileset -r0 'added() or revs("wdir()", added())' | |
375 | a1 |
|
375 | a1 | |
376 | a2 |
|
376 | a2 | |
377 | b1 |
|
377 | b1 | |
378 | b2 |
|
378 | b2 | |
379 | c1 |
|
379 | c1 | |
380 |
|
380 | |||
381 | Test insertion of status hints |
|
381 | Test insertion of status hints | |
382 |
|
382 | |||
383 | $ fileset -p optimized 'added()' |
|
383 | $ fileset -p optimized 'added()' | |
384 | * optimized: |
|
384 | * optimized: | |
385 | (withstatus |
|
385 | (withstatus | |
386 | (func |
|
386 | (func | |
387 | (symbol 'added') |
|
387 | (symbol 'added') | |
388 | None) |
|
388 | None) | |
389 | (string 'added')) |
|
389 | (string 'added')) | |
390 | c1 |
|
390 | c1 | |
391 |
|
391 | |||
392 | $ fileset -p optimized 'a* & removed()' |
|
392 | $ fileset -p optimized 'a* & removed()' | |
393 | * optimized: |
|
393 | * optimized: | |
394 | (and |
|
394 | (and | |
395 | (symbol 'a*') |
|
395 | (symbol 'a*') | |
396 | (withstatus |
|
396 | (withstatus | |
397 | (func |
|
397 | (func | |
398 | (symbol 'removed') |
|
398 | (symbol 'removed') | |
399 | None) |
|
399 | None) | |
400 | (string 'removed'))) |
|
400 | (string 'removed'))) | |
401 | a2 |
|
401 | a2 | |
402 |
|
402 | |||
403 | $ fileset -p optimized 'a* - removed()' |
|
403 | $ fileset -p optimized 'a* - removed()' | |
404 | * optimized: |
|
404 | * optimized: | |
405 | (minus |
|
405 | (minus | |
406 | (symbol 'a*') |
|
406 | (symbol 'a*') | |
407 | (withstatus |
|
407 | (withstatus | |
408 | (func |
|
408 | (func | |
409 | (symbol 'removed') |
|
409 | (symbol 'removed') | |
410 | None) |
|
410 | None) | |
411 | (string 'removed'))) |
|
411 | (string 'removed'))) | |
412 | a1 |
|
412 | a1 | |
413 |
|
413 | |||
414 | $ fileset -p analyzed -p optimized '(added() + removed()) - a*' |
|
414 | $ fileset -p analyzed -p optimized '(added() + removed()) - a*' | |
415 | * analyzed: |
|
415 | * analyzed: | |
416 | (and |
|
416 | (and | |
417 | (withstatus |
|
417 | (withstatus | |
418 | (or |
|
418 | (or | |
419 | (func |
|
419 | (func | |
420 | (symbol 'added') |
|
420 | (symbol 'added') | |
421 | None) |
|
421 | None) | |
422 | (func |
|
422 | (func | |
423 | (symbol 'removed') |
|
423 | (symbol 'removed') | |
424 | None)) |
|
424 | None)) | |
425 | (string 'added removed')) |
|
425 | (string 'added removed')) | |
426 | (not |
|
426 | (not | |
427 | (symbol 'a*'))) |
|
427 | (symbol 'a*'))) | |
428 | * optimized: |
|
428 | * optimized: | |
429 | (and |
|
429 | (and | |
430 | (not |
|
430 | (not | |
431 | (symbol 'a*')) |
|
431 | (symbol 'a*')) | |
432 | (withstatus |
|
432 | (withstatus | |
433 | (or |
|
433 | (or | |
434 | (func |
|
434 | (func | |
435 | (symbol 'added') |
|
435 | (symbol 'added') | |
436 | None) |
|
436 | None) | |
437 | (func |
|
437 | (func | |
438 | (symbol 'removed') |
|
438 | (symbol 'removed') | |
439 | None)) |
|
439 | None)) | |
440 | (string 'added removed'))) |
|
440 | (string 'added removed'))) | |
441 | c1 |
|
441 | c1 | |
442 |
|
442 | |||
443 | $ fileset -p optimized 'a* + b* + added() + unknown()' |
|
443 | $ fileset -p optimized 'a* + b* + added() + unknown()' | |
444 | * optimized: |
|
444 | * optimized: | |
445 | (withstatus |
|
445 | (withstatus | |
446 | (or |
|
446 | (or | |
447 | (patterns |
|
447 | (patterns | |
448 | (symbol 'a*') |
|
448 | (symbol 'a*') | |
449 | (symbol 'b*')) |
|
449 | (symbol 'b*')) | |
450 | (func |
|
450 | (func | |
451 | (symbol 'added') |
|
451 | (symbol 'added') | |
452 | None) |
|
452 | None) | |
453 | (func |
|
453 | (func | |
454 | (symbol 'unknown') |
|
454 | (symbol 'unknown') | |
455 | None)) |
|
455 | None)) | |
456 | (string 'added unknown')) |
|
456 | (string 'added unknown')) | |
457 | a1 |
|
457 | a1 | |
458 | a2 |
|
458 | a2 | |
459 | b1 |
|
459 | b1 | |
460 | b2 |
|
460 | b2 | |
461 | c1 |
|
461 | c1 | |
462 | c3 |
|
462 | c3 | |
463 |
|
463 | |||
464 | $ fileset -p analyzed -p optimized 'removed() & missing() & a*' |
|
464 | $ fileset -p analyzed -p optimized 'removed() & missing() & a*' | |
465 | * analyzed: |
|
465 | * analyzed: | |
466 | (and |
|
466 | (and | |
467 | (withstatus |
|
467 | (withstatus | |
468 | (and |
|
468 | (and | |
469 | (func |
|
469 | (func | |
470 | (symbol 'removed') |
|
470 | (symbol 'removed') | |
471 | None) |
|
471 | None) | |
472 | (func |
|
472 | (func | |
473 | (symbol 'missing') |
|
473 | (symbol 'missing') | |
474 | None)) |
|
474 | None)) | |
475 | (string 'removed missing')) |
|
475 | (string 'removed missing')) | |
476 | (symbol 'a*')) |
|
476 | (symbol 'a*')) | |
477 | * optimized: |
|
477 | * optimized: | |
478 | (and |
|
478 | (and | |
479 | (symbol 'a*') |
|
479 | (symbol 'a*') | |
480 | (withstatus |
|
480 | (withstatus | |
481 | (and |
|
481 | (and | |
482 | (func |
|
482 | (func | |
483 | (symbol 'removed') |
|
483 | (symbol 'removed') | |
484 | None) |
|
484 | None) | |
485 | (func |
|
485 | (func | |
486 | (symbol 'missing') |
|
486 | (symbol 'missing') | |
487 | None)) |
|
487 | None)) | |
488 | (string 'removed missing'))) |
|
488 | (string 'removed missing'))) | |
489 |
|
489 | |||
490 | $ fileset -p optimized 'clean() & revs(0, added())' |
|
490 | $ fileset -p optimized 'clean() & revs(0, added())' | |
491 | * optimized: |
|
491 | * optimized: | |
492 | (and |
|
492 | (and | |
493 | (withstatus |
|
493 | (withstatus | |
494 | (func |
|
494 | (func | |
495 | (symbol 'clean') |
|
495 | (symbol 'clean') | |
496 | None) |
|
496 | None) | |
497 | (string 'clean')) |
|
497 | (string 'clean')) | |
498 | (func |
|
498 | (func | |
499 | (symbol 'revs') |
|
499 | (symbol 'revs') | |
500 | (list |
|
500 | (list | |
501 | (symbol '0') |
|
501 | (symbol '0') | |
502 | (withstatus |
|
502 | (withstatus | |
503 | (func |
|
503 | (func | |
504 | (symbol 'added') |
|
504 | (symbol 'added') | |
505 | None) |
|
505 | None) | |
506 | (string 'added'))))) |
|
506 | (string 'added'))))) | |
507 | b1 |
|
507 | b1 | |
508 |
|
508 | |||
509 | $ fileset -p optimized 'clean() & status(null, 0, b* & added())' |
|
509 | $ fileset -p optimized 'clean() & status(null, 0, b* & added())' | |
510 | * optimized: |
|
510 | * optimized: | |
511 | (and |
|
511 | (and | |
512 | (withstatus |
|
512 | (withstatus | |
513 | (func |
|
513 | (func | |
514 | (symbol 'clean') |
|
514 | (symbol 'clean') | |
515 | None) |
|
515 | None) | |
516 | (string 'clean')) |
|
516 | (string 'clean')) | |
517 | (func |
|
517 | (func | |
518 | (symbol 'status') |
|
518 | (symbol 'status') | |
519 | (list |
|
519 | (list | |
520 | (symbol 'null') |
|
520 | (symbol 'null') | |
521 | (symbol '0') |
|
521 | (symbol '0') | |
522 | (and |
|
522 | (and | |
523 | (symbol 'b*') |
|
523 | (symbol 'b*') | |
524 | (withstatus |
|
524 | (withstatus | |
525 | (func |
|
525 | (func | |
526 | (symbol 'added') |
|
526 | (symbol 'added') | |
527 | None) |
|
527 | None) | |
528 | (string 'added')))))) |
|
528 | (string 'added')))))) | |
529 | b1 |
|
529 | b1 | |
530 |
|
530 | |||
531 | Test files properties |
|
531 | Test files properties | |
532 |
|
532 | |||
533 | >>> open('bin', 'wb').write(b'\0a') and None |
|
533 | >>> open('bin', 'wb').write(b'\0a') and None | |
534 | $ fileset 'binary()' |
|
534 | $ fileset 'binary()' | |
535 | bin |
|
535 | bin | |
536 | $ fileset 'binary() and unknown()' |
|
536 | $ fileset 'binary() and unknown()' | |
537 | bin |
|
537 | bin | |
538 | $ echo '^bin$' >> .hgignore |
|
538 | $ echo '^bin$' >> .hgignore | |
539 | $ fileset 'binary() and ignored()' |
|
539 | $ fileset 'binary() and ignored()' | |
540 | bin |
|
540 | bin | |
541 | $ hg add bin |
|
541 | $ hg add bin | |
542 | $ fileset 'binary()' |
|
542 | $ fileset 'binary()' | |
543 | bin |
|
543 | bin | |
544 |
|
544 | |||
545 | $ fileset -p optimized -s 'binary() and b*' |
|
545 | $ fileset -p optimized -s 'binary() and b*' | |
546 | * optimized: |
|
546 | * optimized: | |
547 | (and |
|
547 | (and | |
548 | (symbol 'b*') |
|
548 | (symbol 'b*') | |
549 | (func |
|
549 | (func | |
550 | (symbol 'binary') |
|
550 | (symbol 'binary') | |
551 | None)) |
|
551 | None)) | |
552 | * matcher: |
|
552 | * matcher: | |
553 | <intersectionmatcher |
|
553 | <intersectionmatcher | |
554 | m1=<patternmatcher patterns='b[^/]*$'>, |
|
554 | m1=<patternmatcher patterns='b[^/]*$'>, | |
555 | m2=<predicatenmatcher pred=binary>> |
|
555 | m2=<predicatenmatcher pred=binary>> | |
556 | bin |
|
556 | bin | |
557 |
|
557 | |||
558 | $ fileset 'grep("b{1}")' |
|
558 | $ fileset 'grep("b{1}")' | |
559 | .hgignore |
|
559 | .hgignore | |
560 | b1 |
|
560 | b1 | |
561 | b2 |
|
561 | b2 | |
562 | c1 |
|
562 | c1 | |
563 | $ fileset 'grep("missingparens(")' |
|
563 | $ fileset 'grep("missingparens(")' | |
564 | hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \)).* (re) |
|
564 | hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \)).* (re) | |
565 | [255] |
|
565 | [255] | |
566 |
|
566 | |||
567 | #if execbit |
|
567 | #if execbit | |
568 | $ chmod +x b2 |
|
568 | $ chmod +x b2 | |
569 | $ fileset 'exec()' |
|
569 | $ fileset 'exec()' | |
570 | b2 |
|
570 | b2 | |
571 | #endif |
|
571 | #endif | |
572 |
|
572 | |||
573 | #if symlink |
|
573 | #if symlink | |
574 | $ ln -s b2 b2link |
|
574 | $ ln -s b2 b2link | |
575 | $ fileset 'symlink() and unknown()' |
|
575 | $ fileset 'symlink() and unknown()' | |
576 | b2link |
|
576 | b2link | |
577 | $ hg add b2link |
|
577 | $ hg add b2link | |
578 | #endif |
|
578 | #endif | |
579 |
|
579 | |||
580 | #if no-windows |
|
580 | #if no-windows | |
581 | $ echo foo > con.xml |
|
581 | $ echo foo > con.xml | |
582 | $ fileset 'not portable()' |
|
582 | $ fileset 'not portable()' | |
583 | con.xml |
|
583 | con.xml | |
584 | $ hg --config ui.portablefilenames=ignore add con.xml |
|
584 | $ hg --config ui.portablefilenames=ignore add con.xml | |
585 | #endif |
|
585 | #endif | |
586 |
|
586 | |||
587 | >>> open('1k', 'wb').write(b' '*1024) and None |
|
587 | >>> open('1k', 'wb').write(b' '*1024) and None | |
588 | >>> open('2k', 'wb').write(b' '*2048) and None |
|
588 | >>> open('2k', 'wb').write(b' '*2048) and None | |
589 | $ hg add 1k 2k |
|
589 | $ hg add 1k 2k | |
590 | $ fileset 'size("bar")' |
|
590 | $ fileset 'size("bar")' | |
591 | hg: parse error: couldn't parse size: bar |
|
591 | hg: parse error: couldn't parse size: bar | |
592 | [255] |
|
592 | [255] | |
593 | $ fileset '(1k, 2k)' |
|
593 | $ fileset '(1k, 2k)' | |
594 | hg: parse error: can't use a list in this context |
|
594 | hg: parse error: can't use a list in this context | |
595 | (see 'hg help "filesets.x or y"') |
|
595 | (see 'hg help "filesets.x or y"') | |
596 | [255] |
|
596 | [255] | |
597 | $ fileset 'size(1k)' |
|
597 | $ fileset 'size(1k)' | |
598 | 1k |
|
598 | 1k | |
599 | $ fileset '(1k or 2k) and size("< 2k")' |
|
599 | $ fileset '(1k or 2k) and size("< 2k")' | |
600 | 1k |
|
600 | 1k | |
601 | $ fileset '(1k or 2k) and size("<=2k")' |
|
601 | $ fileset '(1k or 2k) and size("<=2k")' | |
602 | 1k |
|
602 | 1k | |
603 | 2k |
|
603 | 2k | |
604 | $ fileset '(1k or 2k) and size("> 1k")' |
|
604 | $ fileset '(1k or 2k) and size("> 1k")' | |
605 | 2k |
|
605 | 2k | |
606 | $ fileset '(1k or 2k) and size(">=1K")' |
|
606 | $ fileset '(1k or 2k) and size(">=1K")' | |
607 | 1k |
|
607 | 1k | |
608 | 2k |
|
608 | 2k | |
609 | $ fileset '(1k or 2k) and size(".5KB - 1.5kB")' |
|
609 | $ fileset '(1k or 2k) and size(".5KB - 1.5kB")' | |
610 | 1k |
|
610 | 1k | |
611 | $ fileset 'size("1M")' |
|
611 | $ fileset 'size("1M")' | |
612 | $ fileset 'size("1 GB")' |
|
612 | $ fileset 'size("1 GB")' | |
613 |
|
613 | |||
614 | Test merge states |
|
614 | Test merge states | |
615 |
|
615 | |||
616 | $ hg ci -m manychanges |
|
616 | $ hg ci -m manychanges | |
617 | $ hg file -r . 'set:copied() & modified()' |
|
617 | $ hg file -r . 'set:copied() & modified()' | |
618 | [1] |
|
618 | [1] | |
619 | $ hg up -C 0 |
|
619 | $ hg up -C 0 | |
620 | * files updated, 0 files merged, * files removed, 0 files unresolved (glob) |
|
620 | * files updated, 0 files merged, * files removed, 0 files unresolved (glob) | |
621 | $ echo c >> b2 |
|
621 | $ echo c >> b2 | |
622 | $ hg ci -m diverging b2 |
|
622 | $ hg ci -m diverging b2 | |
623 | created new head |
|
623 | created new head | |
624 | $ fileset 'resolved()' |
|
624 | $ fileset 'resolved()' | |
625 | $ fileset 'unresolved()' |
|
625 | $ fileset 'unresolved()' | |
626 | $ hg merge |
|
626 | $ hg merge | |
627 | merging b2 |
|
627 | merging b2 | |
628 | warning: conflicts while merging b2! (edit, then use 'hg resolve --mark') |
|
628 | warning: conflicts while merging b2! (edit, then use 'hg resolve --mark') | |
629 | * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob) |
|
629 | * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob) | |
630 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
630 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon | |
631 | [1] |
|
631 | [1] | |
632 | $ fileset 'resolved()' |
|
632 | $ fileset 'resolved()' | |
633 | $ fileset 'unresolved()' |
|
633 | $ fileset 'unresolved()' | |
634 | b2 |
|
634 | b2 | |
635 | $ echo e > b2 |
|
635 | $ echo e > b2 | |
636 | $ hg resolve -m b2 |
|
636 | $ hg resolve -m b2 | |
637 | (no more unresolved files) |
|
637 | (no more unresolved files) | |
638 | $ fileset 'resolved()' |
|
638 | $ fileset 'resolved()' | |
639 | b2 |
|
639 | b2 | |
640 | $ fileset 'unresolved()' |
|
640 | $ fileset 'unresolved()' | |
641 | $ hg ci -m merge |
|
641 | $ hg ci -m merge | |
642 |
|
642 | |||
643 | Test subrepo predicate |
|
643 | Test subrepo predicate | |
644 |
|
644 | |||
645 | $ hg init sub |
|
645 | $ hg init sub | |
646 | $ echo a > sub/suba |
|
646 | $ echo a > sub/suba | |
647 | $ hg -R sub add sub/suba |
|
647 | $ hg -R sub add sub/suba | |
648 | $ hg -R sub ci -m sub |
|
648 | $ hg -R sub ci -m sub | |
649 | $ echo 'sub = sub' > .hgsub |
|
649 | $ echo 'sub = sub' > .hgsub | |
650 | $ hg init sub2 |
|
650 | $ hg init sub2 | |
651 | $ echo b > sub2/b |
|
651 | $ echo b > sub2/b | |
652 | $ hg -R sub2 ci -Am sub2 |
|
652 | $ hg -R sub2 ci -Am sub2 | |
653 | adding b |
|
653 | adding b | |
654 | $ echo 'sub2 = sub2' >> .hgsub |
|
654 | $ echo 'sub2 = sub2' >> .hgsub | |
655 | $ fileset 'subrepo()' |
|
655 | $ fileset 'subrepo()' | |
656 | $ hg add .hgsub |
|
656 | $ hg add .hgsub | |
657 | $ fileset 'subrepo()' |
|
657 | $ fileset 'subrepo()' | |
658 | sub |
|
658 | sub | |
659 | sub2 |
|
659 | sub2 | |
660 | $ fileset 'subrepo("sub")' |
|
660 | $ fileset 'subrepo("sub")' | |
661 | sub |
|
661 | sub | |
662 | $ fileset 'subrepo("glob:*")' |
|
662 | $ fileset 'subrepo("glob:*")' | |
663 | sub |
|
663 | sub | |
664 | sub2 |
|
664 | sub2 | |
665 | $ hg ci -m subrepo |
|
665 | $ hg ci -m subrepo | |
666 |
|
666 | |||
667 | Test that .hgsubstate is updated as appropriate during a conversion. The |
|
667 | Test that .hgsubstate is updated as appropriate during a conversion. The | |
668 | saverev property is enough to alter the hashes of the subrepo. |
|
668 | saverev property is enough to alter the hashes of the subrepo. | |
669 |
|
669 | |||
670 | $ hg init ../converted |
|
670 | $ hg init ../converted | |
671 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ |
|
671 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ | |
672 | > sub ../converted/sub |
|
672 | > sub ../converted/sub | |
673 | initializing destination ../converted/sub repository |
|
673 | initializing destination ../converted/sub repository | |
674 | scanning source... |
|
674 | scanning source... | |
675 | sorting... |
|
675 | sorting... | |
676 | converting... |
|
676 | converting... | |
677 | 0 sub |
|
677 | 0 sub | |
678 | $ hg clone -U sub2 ../converted/sub2 |
|
678 | $ hg clone -U sub2 ../converted/sub2 | |
679 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ |
|
679 | $ hg --config extensions.convert= convert --config convert.hg.saverev=True \ | |
680 | > . ../converted |
|
680 | > . ../converted | |
681 | scanning source... |
|
681 | scanning source... | |
682 | sorting... |
|
682 | sorting... | |
683 | converting... |
|
683 | converting... | |
684 | 4 addfiles |
|
684 | 4 addfiles | |
685 | 3 manychanges |
|
685 | 3 manychanges | |
686 | 2 diverging |
|
686 | 2 diverging | |
687 | 1 merge |
|
687 | 1 merge | |
688 | 0 subrepo |
|
688 | 0 subrepo | |
689 | no ".hgsubstate" updates will be made for "sub2" |
|
689 | no ".hgsubstate" updates will be made for "sub2" | |
690 | $ hg up -q -R ../converted -r tip |
|
690 | $ hg up -q -R ../converted -r tip | |
691 | $ hg --cwd ../converted cat sub/suba sub2/b -r tip |
|
691 | $ hg --cwd ../converted cat sub/suba sub2/b -r tip | |
692 | a |
|
692 | a | |
693 | b |
|
693 | b | |
694 | $ oldnode=`hg log -r tip -T "{node}\n"` |
|
694 | $ oldnode=`hg log -r tip -T "{node}\n"` | |
695 | $ newnode=`hg log -R ../converted -r tip -T "{node}\n"` |
|
695 | $ newnode=`hg log -R ../converted -r tip -T "{node}\n"` | |
696 | $ [ "$oldnode" != "$newnode" ] || echo "nothing changed" |
|
696 | $ [ "$oldnode" != "$newnode" ] || echo "nothing changed" | |
697 |
|
697 | |||
698 | Test with a revision |
|
698 | Test with a revision | |
699 |
|
699 | |||
700 | $ hg log -G --template '{rev} {desc}\n' |
|
700 | $ hg log -G --template '{rev} {desc}\n' | |
701 | @ 4 subrepo |
|
701 | @ 4 subrepo | |
702 | | |
|
702 | | | |
703 | o 3 merge |
|
703 | o 3 merge | |
704 | |\ |
|
704 | |\ | |
705 | | o 2 diverging |
|
705 | | o 2 diverging | |
706 | | | |
|
706 | | | | |
707 | o | 1 manychanges |
|
707 | o | 1 manychanges | |
708 | |/ |
|
708 | |/ | |
709 | o 0 addfiles |
|
709 | o 0 addfiles | |
710 |
|
710 | |||
711 | $ echo unknown > unknown |
|
711 | $ echo unknown > unknown | |
712 | $ fileset -r1 'modified()' |
|
712 | $ fileset -r1 'modified()' | |
713 | b2 |
|
713 | b2 | |
714 | $ fileset -r1 'added() and c1' |
|
714 | $ fileset -r1 'added() and c1' | |
715 | c1 |
|
715 | c1 | |
716 | $ fileset -r1 'removed()' |
|
716 | $ fileset -r1 'removed()' | |
717 | a2 |
|
717 | a2 | |
718 | $ fileset -r1 'deleted()' |
|
718 | $ fileset -r1 'deleted()' | |
719 | $ fileset -r1 'unknown()' |
|
719 | $ fileset -r1 'unknown()' | |
720 | $ fileset -r1 'ignored()' |
|
720 | $ fileset -r1 'ignored()' | |
721 | $ fileset -r1 'hgignore()' |
|
721 | $ fileset -r1 'hgignore()' | |
722 | .hgignore |
|
722 | .hgignore | |
723 | a2 |
|
723 | a2 | |
724 | b2 |
|
724 | b2 | |
725 | bin |
|
725 | bin | |
726 | c2 |
|
726 | c2 | |
727 | sub2 |
|
727 | sub2 | |
728 | $ fileset -r1 'binary()' |
|
728 | $ fileset -r1 'binary()' | |
729 | bin |
|
729 | bin | |
730 | $ fileset -r1 'size(1k)' |
|
730 | $ fileset -r1 'size(1k)' | |
731 | 1k |
|
731 | 1k | |
732 | $ fileset -r3 'resolved()' |
|
732 | $ fileset -r3 'resolved()' | |
733 | $ fileset -r3 'unresolved()' |
|
733 | $ fileset -r3 'unresolved()' | |
734 |
|
734 | |||
735 | #if execbit |
|
735 | #if execbit | |
736 | $ fileset -r1 'exec()' |
|
736 | $ fileset -r1 'exec()' | |
737 | b2 |
|
737 | b2 | |
738 | #endif |
|
738 | #endif | |
739 |
|
739 | |||
740 | #if symlink |
|
740 | #if symlink | |
741 | $ fileset -r1 'symlink()' |
|
741 | $ fileset -r1 'symlink()' | |
742 | b2link |
|
742 | b2link | |
743 | #endif |
|
743 | #endif | |
744 |
|
744 | |||
745 | #if no-windows |
|
745 | #if no-windows | |
746 | $ fileset -r1 'not portable()' |
|
746 | $ fileset -r1 'not portable()' | |
747 | con.xml |
|
747 | con.xml | |
748 | $ hg forget 'con.xml' |
|
748 | $ hg forget 'con.xml' | |
749 | #endif |
|
749 | #endif | |
750 |
|
750 | |||
751 | $ fileset -r4 'subrepo("re:su.*")' |
|
751 | $ fileset -r4 'subrepo("re:su.*")' | |
752 | sub |
|
752 | sub | |
753 | sub2 |
|
753 | sub2 | |
754 | $ fileset -r4 'subrepo(re:su.*)' |
|
754 | $ fileset -r4 'subrepo(re:su.*)' | |
755 | sub |
|
755 | sub | |
756 | sub2 |
|
756 | sub2 | |
757 | $ fileset -r4 'subrepo("sub")' |
|
757 | $ fileset -r4 'subrepo("sub")' | |
758 | sub |
|
758 | sub | |
759 | $ fileset -r4 'b2 or c1' |
|
759 | $ fileset -r4 'b2 or c1' | |
760 | b2 |
|
760 | b2 | |
761 | c1 |
|
761 | c1 | |
762 |
|
762 | |||
763 | >>> open('dos', 'wb').write(b"dos\r\n") and None |
|
763 | >>> open('dos', 'wb').write(b"dos\r\n") and None | |
764 | >>> open('mixed', 'wb').write(b"dos\r\nunix\n") and None |
|
764 | >>> open('mixed', 'wb').write(b"dos\r\nunix\n") and None | |
765 | >>> open('mac', 'wb').write(b"mac\r") and None |
|
765 | >>> open('mac', 'wb').write(b"mac\r") and None | |
766 | $ hg add dos mixed mac |
|
766 | $ hg add dos mixed mac | |
767 |
|
767 | |||
768 | (remove a1, to examine safety of 'eol' on removed files) |
|
768 | (remove a1, to examine safety of 'eol' on removed files) | |
769 | $ rm a1 |
|
769 | $ rm a1 | |
770 |
|
770 | |||
771 | $ fileset 'eol(dos)' |
|
771 | $ fileset 'eol(dos)' | |
772 | dos |
|
772 | dos | |
773 | mixed |
|
773 | mixed | |
774 | $ fileset 'eol(unix)' |
|
774 | $ fileset 'eol(unix)' | |
775 | .hgignore |
|
775 | .hgignore | |
776 | .hgsub |
|
776 | .hgsub | |
777 | .hgsubstate |
|
777 | .hgsubstate | |
778 | b1 |
|
778 | b1 | |
779 | b2 |
|
779 | b2 | |
780 | b2.orig |
|
780 | b2.orig | |
781 | c1 |
|
781 | c1 | |
782 | c2 |
|
782 | c2 | |
783 | c3 |
|
783 | c3 | |
784 | con.xml (no-windows !) |
|
784 | con.xml (no-windows !) | |
785 | mixed |
|
785 | mixed | |
786 | unknown |
|
786 | unknown | |
787 | $ fileset 'eol(mac)' |
|
787 | $ fileset 'eol(mac)' | |
788 | mac |
|
788 | mac | |
789 |
|
789 | |||
790 | Test safety of 'encoding' on removed files |
|
790 | Test safety of 'encoding' on removed files | |
791 |
|
791 | |||
792 | $ fileset 'encoding("ascii")' |
|
792 | $ fileset 'encoding("ascii")' | |
793 | .hgignore |
|
793 | .hgignore | |
794 | .hgsub |
|
794 | .hgsub | |
795 | .hgsubstate |
|
795 | .hgsubstate | |
796 | 1k |
|
796 | 1k | |
797 | 2k |
|
797 | 2k | |
798 | b1 |
|
798 | b1 | |
799 | b2 |
|
799 | b2 | |
800 | b2.orig |
|
800 | b2.orig | |
801 | b2link (symlink !) |
|
801 | b2link (symlink !) | |
802 | bin |
|
802 | bin | |
803 | c1 |
|
803 | c1 | |
804 | c2 |
|
804 | c2 | |
805 | c3 |
|
805 | c3 | |
806 | con.xml (no-windows !) |
|
806 | con.xml (no-windows !) | |
807 | dos |
|
807 | dos | |
808 | mac |
|
808 | mac | |
809 | mixed |
|
809 | mixed | |
810 | unknown |
|
810 | unknown | |
811 |
|
811 | |||
812 | Test 'revs(...)' |
|
812 | Test 'revs(...)' | |
813 | ================ |
|
813 | ================ | |
814 |
|
814 | |||
815 | small reminder of the repository state |
|
815 | small reminder of the repository state | |
816 |
|
816 | |||
817 | $ hg log -G |
|
817 | $ hg log -G | |
818 | @ changeset: 4:* (glob) |
|
818 | @ changeset: 4:* (glob) | |
819 | | tag: tip |
|
819 | | tag: tip | |
820 | | user: test |
|
820 | | user: test | |
821 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
821 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
822 | | summary: subrepo |
|
822 | | summary: subrepo | |
823 | | |
|
823 | | | |
824 | o changeset: 3:* (glob) |
|
824 | o changeset: 3:* (glob) | |
825 | |\ parent: 2:55b05bdebf36 |
|
825 | |\ parent: 2:55b05bdebf36 | |
826 | | | parent: 1:* (glob) |
|
826 | | | parent: 1:* (glob) | |
827 | | | user: test |
|
827 | | | user: test | |
828 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
828 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
829 | | | summary: merge |
|
829 | | | summary: merge | |
830 | | | |
|
830 | | | | |
831 | | o changeset: 2:55b05bdebf36 |
|
831 | | o changeset: 2:55b05bdebf36 | |
832 | | | parent: 0:8a9576c51c1f |
|
832 | | | parent: 0:8a9576c51c1f | |
833 | | | user: test |
|
833 | | | user: test | |
834 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
834 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
835 | | | summary: diverging |
|
835 | | | summary: diverging | |
836 | | | |
|
836 | | | | |
837 | o | changeset: 1:* (glob) |
|
837 | o | changeset: 1:* (glob) | |
838 | |/ user: test |
|
838 | |/ user: test | |
839 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
839 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
840 | | summary: manychanges |
|
840 | | summary: manychanges | |
841 | | |
|
841 | | | |
842 | o changeset: 0:8a9576c51c1f |
|
842 | o changeset: 0:8a9576c51c1f | |
843 | user: test |
|
843 | user: test | |
844 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
844 | date: Thu Jan 01 00:00:00 1970 +0000 | |
845 | summary: addfiles |
|
845 | summary: addfiles | |
846 |
|
846 | |||
847 | $ hg status --change 0 |
|
847 | $ hg status --change 0 | |
848 | A a1 |
|
848 | A a1 | |
849 | A a2 |
|
849 | A a2 | |
850 | A b1 |
|
850 | A b1 | |
851 | A b2 |
|
851 | A b2 | |
852 | $ hg status --change 1 |
|
852 | $ hg status --change 1 | |
853 | M b2 |
|
853 | M b2 | |
854 | A 1k |
|
854 | A 1k | |
855 | A 2k |
|
855 | A 2k | |
856 |
A b2link ( |
|
856 | A b2link (symlink !) | |
857 | A bin |
|
857 | A bin | |
858 | A c1 |
|
858 | A c1 | |
859 | A con.xml (no-windows !) |
|
859 | A con.xml (no-windows !) | |
860 | R a2 |
|
860 | R a2 | |
861 | $ hg status --change 2 |
|
861 | $ hg status --change 2 | |
862 | M b2 |
|
862 | M b2 | |
863 | $ hg status --change 3 |
|
863 | $ hg status --change 3 | |
864 | M b2 |
|
864 | M b2 | |
865 | A 1k |
|
865 | A 1k | |
866 | A 2k |
|
866 | A 2k | |
867 |
A b2link ( |
|
867 | A b2link (symlink !) | |
868 | A bin |
|
868 | A bin | |
869 | A c1 |
|
869 | A c1 | |
870 | A con.xml (no-windows !) |
|
870 | A con.xml (no-windows !) | |
871 | R a2 |
|
871 | R a2 | |
872 | $ hg status --change 4 |
|
872 | $ hg status --change 4 | |
873 | A .hgsub |
|
873 | A .hgsub | |
874 | A .hgsubstate |
|
874 | A .hgsubstate | |
875 | $ hg status |
|
875 | $ hg status | |
876 | A dos |
|
876 | A dos | |
877 | A mac |
|
877 | A mac | |
878 | A mixed |
|
878 | A mixed | |
879 | R con.xml (no-windows !) |
|
879 | R con.xml (no-windows !) | |
880 | ! a1 |
|
880 | ! a1 | |
881 | ? b2.orig |
|
881 | ? b2.orig | |
882 | ? c3 |
|
882 | ? c3 | |
883 | ? unknown |
|
883 | ? unknown | |
884 |
|
884 | |||
885 | Test files at -r0 should be filtered by files at wdir |
|
885 | Test files at -r0 should be filtered by files at wdir | |
886 | ----------------------------------------------------- |
|
886 | ----------------------------------------------------- | |
887 |
|
887 | |||
888 | $ fileset -r0 'tracked() and revs("wdir()", tracked())' |
|
888 | $ fileset -r0 'tracked() and revs("wdir()", tracked())' | |
889 | a1 |
|
889 | a1 | |
890 | b1 |
|
890 | b1 | |
891 | b2 |
|
891 | b2 | |
892 |
|
892 | |||
893 | Test that "revs()" work at all |
|
893 | Test that "revs()" work at all | |
894 | ------------------------------ |
|
894 | ------------------------------ | |
895 |
|
895 | |||
896 | $ fileset "revs('2', modified())" |
|
896 | $ fileset "revs('2', modified())" | |
897 | b2 |
|
897 | b2 | |
898 |
|
898 | |||
899 | Test that "revs()" work for file missing in the working copy/current context |
|
899 | Test that "revs()" work for file missing in the working copy/current context | |
900 | ---------------------------------------------------------------------------- |
|
900 | ---------------------------------------------------------------------------- | |
901 |
|
901 | |||
902 | (a2 not in working copy) |
|
902 | (a2 not in working copy) | |
903 |
|
903 | |||
904 | $ fileset "revs('0', added())" |
|
904 | $ fileset "revs('0', added())" | |
905 | a1 |
|
905 | a1 | |
906 | a2 |
|
906 | a2 | |
907 | b1 |
|
907 | b1 | |
908 | b2 |
|
908 | b2 | |
909 |
|
909 | |||
910 | (none of the file exist in "0") |
|
910 | (none of the file exist in "0") | |
911 |
|
911 | |||
912 | $ fileset -r 0 "revs('4', added())" |
|
912 | $ fileset -r 0 "revs('4', added())" | |
913 | .hgsub |
|
913 | .hgsub | |
914 | .hgsubstate |
|
914 | .hgsubstate | |
915 |
|
915 | |||
916 | Call with empty revset |
|
916 | Call with empty revset | |
917 | -------------------------- |
|
917 | -------------------------- | |
918 |
|
918 | |||
919 | $ fileset "revs('2-2', modified())" |
|
919 | $ fileset "revs('2-2', modified())" | |
920 |
|
920 | |||
921 | Call with revset matching multiple revs |
|
921 | Call with revset matching multiple revs | |
922 | --------------------------------------- |
|
922 | --------------------------------------- | |
923 |
|
923 | |||
924 | $ fileset "revs('0+4', added())" |
|
924 | $ fileset "revs('0+4', added())" | |
925 | .hgsub |
|
925 | .hgsub | |
926 | .hgsubstate |
|
926 | .hgsubstate | |
927 | a1 |
|
927 | a1 | |
928 | a2 |
|
928 | a2 | |
929 | b1 |
|
929 | b1 | |
930 | b2 |
|
930 | b2 | |
931 |
|
931 | |||
932 | overlapping set |
|
932 | overlapping set | |
933 |
|
933 | |||
934 | $ fileset "revs('1+2', modified())" |
|
934 | $ fileset "revs('1+2', modified())" | |
935 | b2 |
|
935 | b2 | |
936 |
|
936 | |||
937 | test 'status(...)' |
|
937 | test 'status(...)' | |
938 | ================= |
|
938 | ================= | |
939 |
|
939 | |||
940 | Simple case |
|
940 | Simple case | |
941 | ----------- |
|
941 | ----------- | |
942 |
|
942 | |||
943 | $ fileset "status(3, 4, added())" |
|
943 | $ fileset "status(3, 4, added())" | |
944 | .hgsub |
|
944 | .hgsub | |
945 | .hgsubstate |
|
945 | .hgsubstate | |
946 |
|
946 | |||
947 | use rev to restrict matched file |
|
947 | use rev to restrict matched file | |
948 | ----------------------------------------- |
|
948 | ----------------------------------------- | |
949 |
|
949 | |||
950 | $ hg status --removed --rev 0 --rev 1 |
|
950 | $ hg status --removed --rev 0 --rev 1 | |
951 | R a2 |
|
951 | R a2 | |
952 | $ fileset "status(0, 1, removed())" |
|
952 | $ fileset "status(0, 1, removed())" | |
953 | a2 |
|
953 | a2 | |
954 | $ fileset "tracked() and status(0, 1, removed())" |
|
954 | $ fileset "tracked() and status(0, 1, removed())" | |
955 | $ fileset -r 4 "status(0, 1, removed())" |
|
955 | $ fileset -r 4 "status(0, 1, removed())" | |
956 | a2 |
|
956 | a2 | |
957 | $ fileset -r 4 "tracked() and status(0, 1, removed())" |
|
957 | $ fileset -r 4 "tracked() and status(0, 1, removed())" | |
958 | $ fileset "revs('4', tracked() and status(0, 1, removed()))" |
|
958 | $ fileset "revs('4', tracked() and status(0, 1, removed()))" | |
959 | $ fileset "revs('0', tracked() and status(0, 1, removed()))" |
|
959 | $ fileset "revs('0', tracked() and status(0, 1, removed()))" | |
960 | a2 |
|
960 | a2 | |
961 |
|
961 | |||
962 | check wdir() |
|
962 | check wdir() | |
963 | ------------ |
|
963 | ------------ | |
964 |
|
964 | |||
965 | $ hg status --removed --rev 4 |
|
965 | $ hg status --removed --rev 4 | |
966 | R con.xml (no-windows !) |
|
966 | R con.xml (no-windows !) | |
967 | $ fileset "status(4, 'wdir()', removed())" |
|
967 | $ fileset "status(4, 'wdir()', removed())" | |
968 | con.xml (no-windows !) |
|
968 | con.xml (no-windows !) | |
969 |
|
969 | |||
970 | $ hg status --removed --rev 2 |
|
970 | $ hg status --removed --rev 2 | |
971 | R a2 |
|
971 | R a2 | |
972 | $ fileset "status('2', 'wdir()', removed())" |
|
972 | $ fileset "status('2', 'wdir()', removed())" | |
973 | a2 |
|
973 | a2 | |
974 |
|
974 | |||
975 | test backward status |
|
975 | test backward status | |
976 | -------------------- |
|
976 | -------------------- | |
977 |
|
977 | |||
978 | $ hg status --removed --rev 0 --rev 4 |
|
978 | $ hg status --removed --rev 0 --rev 4 | |
979 | R a2 |
|
979 | R a2 | |
980 | $ hg status --added --rev 4 --rev 0 |
|
980 | $ hg status --added --rev 4 --rev 0 | |
981 | A a2 |
|
981 | A a2 | |
982 | $ fileset "status(4, 0, added())" |
|
982 | $ fileset "status(4, 0, added())" | |
983 | a2 |
|
983 | a2 | |
984 |
|
984 | |||
985 | test cross branch status |
|
985 | test cross branch status | |
986 | ------------------------ |
|
986 | ------------------------ | |
987 |
|
987 | |||
988 | $ hg status --added --rev 1 --rev 2 |
|
988 | $ hg status --added --rev 1 --rev 2 | |
989 | A a2 |
|
989 | A a2 | |
990 | $ fileset "status(1, 2, added())" |
|
990 | $ fileset "status(1, 2, added())" | |
991 | a2 |
|
991 | a2 | |
992 |
|
992 | |||
993 | test with multi revs revset |
|
993 | test with multi revs revset | |
994 | --------------------------- |
|
994 | --------------------------- | |
995 | $ hg status --added --rev 0:1 --rev 3:4 |
|
995 | $ hg status --added --rev 0:1 --rev 3:4 | |
996 | A .hgsub |
|
996 | A .hgsub | |
997 | A .hgsubstate |
|
997 | A .hgsubstate | |
998 | A 1k |
|
998 | A 1k | |
999 | A 2k |
|
999 | A 2k | |
1000 |
A b2link ( |
|
1000 | A b2link (symlink !) | |
1001 | A bin |
|
1001 | A bin | |
1002 | A c1 |
|
1002 | A c1 | |
1003 | A con.xml (no-windows !) |
|
1003 | A con.xml (no-windows !) | |
1004 | $ fileset "status('0:1', '3:4', added())" |
|
1004 | $ fileset "status('0:1', '3:4', added())" | |
1005 | .hgsub |
|
1005 | .hgsub | |
1006 | .hgsubstate |
|
1006 | .hgsubstate | |
1007 | 1k |
|
1007 | 1k | |
1008 | 2k |
|
1008 | 2k | |
1009 |
b2link ( |
|
1009 | b2link (symlink !) | |
1010 | bin |
|
1010 | bin | |
1011 | c1 |
|
1011 | c1 | |
1012 | con.xml (no-windows !) |
|
1012 | con.xml (no-windows !) | |
1013 |
|
1013 | |||
1014 | tests with empty value |
|
1014 | tests with empty value | |
1015 | ---------------------- |
|
1015 | ---------------------- | |
1016 |
|
1016 | |||
1017 | Fully empty revset |
|
1017 | Fully empty revset | |
1018 |
|
1018 | |||
1019 | $ fileset "status('', '4', added())" |
|
1019 | $ fileset "status('', '4', added())" | |
1020 | hg: parse error: first argument to status must be a revision |
|
1020 | hg: parse error: first argument to status must be a revision | |
1021 | [255] |
|
1021 | [255] | |
1022 | $ fileset "status('2', '', added())" |
|
1022 | $ fileset "status('2', '', added())" | |
1023 | hg: parse error: second argument to status must be a revision |
|
1023 | hg: parse error: second argument to status must be a revision | |
1024 | [255] |
|
1024 | [255] | |
1025 |
|
1025 | |||
1026 | Empty revset will error at the revset layer |
|
1026 | Empty revset will error at the revset layer | |
1027 |
|
1027 | |||
1028 | $ fileset "status(' ', '4', added())" |
|
1028 | $ fileset "status(' ', '4', added())" | |
1029 | hg: parse error at 1: not a prefix: end |
|
1029 | hg: parse error at 1: not a prefix: end | |
1030 | ( |
|
1030 | ( | |
1031 | ^ here) |
|
1031 | ^ here) | |
1032 | [255] |
|
1032 | [255] | |
1033 | $ fileset "status('2', ' ', added())" |
|
1033 | $ fileset "status('2', ' ', added())" | |
1034 | hg: parse error at 1: not a prefix: end |
|
1034 | hg: parse error at 1: not a prefix: end | |
1035 | ( |
|
1035 | ( | |
1036 | ^ here) |
|
1036 | ^ here) | |
1037 | [255] |
|
1037 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now