##// END OF EJS Templates
tests: add tests for matching keyword...
Angel Ezquerra -
r16447:60c379da default
parent child Browse files
Show More
@@ -1,711 +1,716 b''
1 $ "$TESTDIR/hghave" no-msys || exit 80 # MSYS will translate /a/b/c/ as if it was a real file path
1 $ "$TESTDIR/hghave" no-msys || exit 80 # MSYS will translate /a/b/c/ as if it was a real file path
2
2
3 $ HGENCODING=utf-8
3 $ HGENCODING=utf-8
4 $ export HGENCODING
4 $ export HGENCODING
5
5
6 $ try() {
6 $ try() {
7 > hg debugrevspec --debug "$@"
7 > hg debugrevspec --debug "$@"
8 > }
8 > }
9
9
10 $ log() {
10 $ log() {
11 > hg log --template '{rev}\n' -r "$1"
11 > hg log --template '{rev}\n' -r "$1"
12 > }
12 > }
13
13
14 $ hg init repo
14 $ hg init repo
15 $ cd repo
15 $ cd repo
16
16
17 $ echo a > a
17 $ echo a > a
18 $ hg branch a
18 $ hg branch a
19 marked working directory as branch a
19 marked working directory as branch a
20 (branches are permanent and global, did you want a bookmark?)
20 (branches are permanent and global, did you want a bookmark?)
21 $ hg ci -Aqm0
21 $ hg ci -Aqm0
22
22
23 $ echo b > b
23 $ echo b > b
24 $ hg branch b
24 $ hg branch b
25 marked working directory as branch b
25 marked working directory as branch b
26 (branches are permanent and global, did you want a bookmark?)
26 (branches are permanent and global, did you want a bookmark?)
27 $ hg ci -Aqm1
27 $ hg ci -Aqm1
28
28
29 $ rm a
29 $ rm a
30 $ hg branch a-b-c-
30 $ hg branch a-b-c-
31 marked working directory as branch a-b-c-
31 marked working directory as branch a-b-c-
32 (branches are permanent and global, did you want a bookmark?)
32 (branches are permanent and global, did you want a bookmark?)
33 $ hg ci -Aqm2 -u Bob
33 $ hg ci -Aqm2 -u Bob
34
34
35 $ hg co 1
35 $ hg co 1
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 $ hg branch +a+b+c+
37 $ hg branch +a+b+c+
38 marked working directory as branch +a+b+c+
38 marked working directory as branch +a+b+c+
39 (branches are permanent and global, did you want a bookmark?)
39 (branches are permanent and global, did you want a bookmark?)
40 $ hg ci -Aqm3
40 $ hg ci -Aqm3
41
41
42 $ hg co 2 # interleave
42 $ hg co 2 # interleave
43 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
43 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
44 $ echo bb > b
44 $ echo bb > b
45 $ hg branch -- -a-b-c-
45 $ hg branch -- -a-b-c-
46 marked working directory as branch -a-b-c-
46 marked working directory as branch -a-b-c-
47 (branches are permanent and global, did you want a bookmark?)
47 (branches are permanent and global, did you want a bookmark?)
48 $ hg ci -Aqm4 -d "May 12 2005"
48 $ hg ci -Aqm4 -d "May 12 2005"
49
49
50 $ hg co 3
50 $ hg co 3
51 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 $ hg branch /a/b/c/
52 $ hg branch /a/b/c/
53 marked working directory as branch /a/b/c/
53 marked working directory as branch /a/b/c/
54 (branches are permanent and global, did you want a bookmark?)
54 (branches are permanent and global, did you want a bookmark?)
55 $ hg ci -Aqm"5 bug"
55 $ hg ci -Aqm"5 bug"
56
56
57 $ hg merge 4
57 $ hg merge 4
58 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
59 (branch merge, don't forget to commit)
59 (branch merge, don't forget to commit)
60 $ hg branch _a_b_c_
60 $ hg branch _a_b_c_
61 marked working directory as branch _a_b_c_
61 marked working directory as branch _a_b_c_
62 (branches are permanent and global, did you want a bookmark?)
62 (branches are permanent and global, did you want a bookmark?)
63 $ hg ci -Aqm"6 issue619"
63 $ hg ci -Aqm"6 issue619"
64
64
65 $ hg branch .a.b.c.
65 $ hg branch .a.b.c.
66 marked working directory as branch .a.b.c.
66 marked working directory as branch .a.b.c.
67 (branches are permanent and global, did you want a bookmark?)
67 (branches are permanent and global, did you want a bookmark?)
68 $ hg ci -Aqm7
68 $ hg ci -Aqm7
69
69
70 $ hg branch all
70 $ hg branch all
71 marked working directory as branch all
71 marked working directory as branch all
72 (branches are permanent and global, did you want a bookmark?)
72 (branches are permanent and global, did you want a bookmark?)
73 $ hg ci --close-branch -Aqm8
73 $ hg ci --close-branch -Aqm8
74 abort: can only close branch heads
74 abort: can only close branch heads
75 [255]
75 [255]
76
76
77 $ hg co 4
77 $ hg co 4
78 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 $ hg branch Γ©
79 $ hg branch Γ©
80 marked working directory as branch \xc3\xa9 (esc)
80 marked working directory as branch \xc3\xa9 (esc)
81 (branches are permanent and global, did you want a bookmark?)
81 (branches are permanent and global, did you want a bookmark?)
82 $ hg ci -Aqm9
82 $ hg ci -Aqm9
83
83
84 $ hg tag -r6 1.0
84 $ hg tag -r6 1.0
85
85
86 $ hg clone --quiet -U -r 7 . ../remote1
86 $ hg clone --quiet -U -r 7 . ../remote1
87 $ hg clone --quiet -U -r 8 . ../remote2
87 $ hg clone --quiet -U -r 8 . ../remote2
88 $ echo "[paths]" >> .hg/hgrc
88 $ echo "[paths]" >> .hg/hgrc
89 $ echo "default = ../remote1" >> .hg/hgrc
89 $ echo "default = ../remote1" >> .hg/hgrc
90
90
91 names that should work without quoting
91 names that should work without quoting
92
92
93 $ try a
93 $ try a
94 ('symbol', 'a')
94 ('symbol', 'a')
95 0
95 0
96 $ try b-a
96 $ try b-a
97 (minus
97 (minus
98 ('symbol', 'b')
98 ('symbol', 'b')
99 ('symbol', 'a'))
99 ('symbol', 'a'))
100 1
100 1
101 $ try _a_b_c_
101 $ try _a_b_c_
102 ('symbol', '_a_b_c_')
102 ('symbol', '_a_b_c_')
103 6
103 6
104 $ try _a_b_c_-a
104 $ try _a_b_c_-a
105 (minus
105 (minus
106 ('symbol', '_a_b_c_')
106 ('symbol', '_a_b_c_')
107 ('symbol', 'a'))
107 ('symbol', 'a'))
108 6
108 6
109 $ try .a.b.c.
109 $ try .a.b.c.
110 ('symbol', '.a.b.c.')
110 ('symbol', '.a.b.c.')
111 7
111 7
112 $ try .a.b.c.-a
112 $ try .a.b.c.-a
113 (minus
113 (minus
114 ('symbol', '.a.b.c.')
114 ('symbol', '.a.b.c.')
115 ('symbol', 'a'))
115 ('symbol', 'a'))
116 7
116 7
117 $ try -- '-a-b-c-' # complains
117 $ try -- '-a-b-c-' # complains
118 hg: parse error at 7: not a prefix: end
118 hg: parse error at 7: not a prefix: end
119 [255]
119 [255]
120 $ log -a-b-c- # succeeds with fallback
120 $ log -a-b-c- # succeeds with fallback
121 4
121 4
122 $ try -- -a-b-c--a # complains
122 $ try -- -a-b-c--a # complains
123 (minus
123 (minus
124 (minus
124 (minus
125 (minus
125 (minus
126 (negate
126 (negate
127 ('symbol', 'a'))
127 ('symbol', 'a'))
128 ('symbol', 'b'))
128 ('symbol', 'b'))
129 ('symbol', 'c'))
129 ('symbol', 'c'))
130 (negate
130 (negate
131 ('symbol', 'a')))
131 ('symbol', 'a')))
132 abort: unknown revision '-a'!
132 abort: unknown revision '-a'!
133 [255]
133 [255]
134 $ try Γ©
134 $ try Γ©
135 ('symbol', '\xc3\xa9')
135 ('symbol', '\xc3\xa9')
136 9
136 9
137
137
138 quoting needed
138 quoting needed
139
139
140 $ try '"-a-b-c-"-a'
140 $ try '"-a-b-c-"-a'
141 (minus
141 (minus
142 ('string', '-a-b-c-')
142 ('string', '-a-b-c-')
143 ('symbol', 'a'))
143 ('symbol', 'a'))
144 4
144 4
145
145
146 $ log '1 or 2'
146 $ log '1 or 2'
147 1
147 1
148 2
148 2
149 $ log '1|2'
149 $ log '1|2'
150 1
150 1
151 2
151 2
152 $ log '1 and 2'
152 $ log '1 and 2'
153 $ log '1&2'
153 $ log '1&2'
154 $ try '1&2|3' # precedence - and is higher
154 $ try '1&2|3' # precedence - and is higher
155 (or
155 (or
156 (and
156 (and
157 ('symbol', '1')
157 ('symbol', '1')
158 ('symbol', '2'))
158 ('symbol', '2'))
159 ('symbol', '3'))
159 ('symbol', '3'))
160 3
160 3
161 $ try '1|2&3'
161 $ try '1|2&3'
162 (or
162 (or
163 ('symbol', '1')
163 ('symbol', '1')
164 (and
164 (and
165 ('symbol', '2')
165 ('symbol', '2')
166 ('symbol', '3')))
166 ('symbol', '3')))
167 1
167 1
168 $ try '1&2&3' # associativity
168 $ try '1&2&3' # associativity
169 (and
169 (and
170 (and
170 (and
171 ('symbol', '1')
171 ('symbol', '1')
172 ('symbol', '2'))
172 ('symbol', '2'))
173 ('symbol', '3'))
173 ('symbol', '3'))
174 $ try '1|(2|3)'
174 $ try '1|(2|3)'
175 (or
175 (or
176 ('symbol', '1')
176 ('symbol', '1')
177 (group
177 (group
178 (or
178 (or
179 ('symbol', '2')
179 ('symbol', '2')
180 ('symbol', '3'))))
180 ('symbol', '3'))))
181 1
181 1
182 2
182 2
183 3
183 3
184 $ log '1.0' # tag
184 $ log '1.0' # tag
185 6
185 6
186 $ log 'a' # branch
186 $ log 'a' # branch
187 0
187 0
188 $ log '2785f51ee'
188 $ log '2785f51ee'
189 0
189 0
190 $ log 'date(2005)'
190 $ log 'date(2005)'
191 4
191 4
192 $ log 'date(this is a test)'
192 $ log 'date(this is a test)'
193 hg: parse error at 10: unexpected token: symbol
193 hg: parse error at 10: unexpected token: symbol
194 [255]
194 [255]
195 $ log 'date()'
195 $ log 'date()'
196 hg: parse error: date requires a string
196 hg: parse error: date requires a string
197 [255]
197 [255]
198 $ log 'date'
198 $ log 'date'
199 hg: parse error: can't use date here
199 hg: parse error: can't use date here
200 [255]
200 [255]
201 $ log 'date('
201 $ log 'date('
202 hg: parse error at 5: not a prefix: end
202 hg: parse error at 5: not a prefix: end
203 [255]
203 [255]
204 $ log 'date(tip)'
204 $ log 'date(tip)'
205 abort: invalid date: 'tip'
205 abort: invalid date: 'tip'
206 [255]
206 [255]
207 $ log '"date"'
207 $ log '"date"'
208 abort: unknown revision 'date'!
208 abort: unknown revision 'date'!
209 [255]
209 [255]
210 $ log 'date(2005) and 1::'
210 $ log 'date(2005) and 1::'
211 4
211 4
212
212
213 $ log 'ancestor(1)'
213 $ log 'ancestor(1)'
214 hg: parse error: ancestor requires two arguments
214 hg: parse error: ancestor requires two arguments
215 [255]
215 [255]
216 $ log 'ancestor(4,5)'
216 $ log 'ancestor(4,5)'
217 1
217 1
218 $ log 'ancestor(4,5) and 4'
218 $ log 'ancestor(4,5) and 4'
219 $ log 'ancestors(5)'
219 $ log 'ancestors(5)'
220 0
220 0
221 1
221 1
222 3
222 3
223 5
223 5
224 $ log 'author(bob)'
224 $ log 'author(bob)'
225 2
225 2
226 $ log 'branch(Γ©)'
226 $ log 'branch(Γ©)'
227 8
227 8
228 9
228 9
229 $ log 'children(ancestor(4,5))'
229 $ log 'children(ancestor(4,5))'
230 2
230 2
231 3
231 3
232 $ log 'closed()'
232 $ log 'closed()'
233 $ log 'contains(a)'
233 $ log 'contains(a)'
234 0
234 0
235 1
235 1
236 3
236 3
237 5
237 5
238 $ log 'desc(B)'
238 $ log 'desc(B)'
239 5
239 5
240 $ log 'descendants(2 or 3)'
240 $ log 'descendants(2 or 3)'
241 2
241 2
242 3
242 3
243 4
243 4
244 5
244 5
245 6
245 6
246 7
246 7
247 8
247 8
248 9
248 9
249 $ log 'file("b*")'
249 $ log 'file("b*")'
250 1
250 1
251 4
251 4
252 $ log 'follow()'
252 $ log 'follow()'
253 0
253 0
254 1
254 1
255 2
255 2
256 4
256 4
257 8
257 8
258 9
258 9
259 $ log 'grep("issue\d+")'
259 $ log 'grep("issue\d+")'
260 6
260 6
261 $ try 'grep("(")' # invalid regular expression
261 $ try 'grep("(")' # invalid regular expression
262 (func
262 (func
263 ('symbol', 'grep')
263 ('symbol', 'grep')
264 ('string', '('))
264 ('string', '('))
265 hg: parse error: invalid match pattern: unbalanced parenthesis
265 hg: parse error: invalid match pattern: unbalanced parenthesis
266 [255]
266 [255]
267 $ try 'grep("\bissue\d+")'
267 $ try 'grep("\bissue\d+")'
268 (func
268 (func
269 ('symbol', 'grep')
269 ('symbol', 'grep')
270 ('string', '\x08issue\\d+'))
270 ('string', '\x08issue\\d+'))
271 $ try 'grep(r"\bissue\d+")'
271 $ try 'grep(r"\bissue\d+")'
272 (func
272 (func
273 ('symbol', 'grep')
273 ('symbol', 'grep')
274 ('string', '\\bissue\\d+'))
274 ('string', '\\bissue\\d+'))
275 6
275 6
276 $ try 'grep(r"\")'
276 $ try 'grep(r"\")'
277 hg: parse error at 7: unterminated string
277 hg: parse error at 7: unterminated string
278 [255]
278 [255]
279 $ log 'head()'
279 $ log 'head()'
280 0
280 0
281 1
281 1
282 2
282 2
283 3
283 3
284 4
284 4
285 5
285 5
286 6
286 6
287 7
287 7
288 9
288 9
289 $ log 'heads(6::)'
289 $ log 'heads(6::)'
290 7
290 7
291 $ log 'keyword(issue)'
291 $ log 'keyword(issue)'
292 6
292 6
293 $ log 'limit(head(), 1)'
293 $ log 'limit(head(), 1)'
294 0
294 0
295 $ log 'matching(6)'
296 6
297 $ log 'matching(6:7, "phase parents user date branch summary files description substate")'
298 6
299 7
295 $ log 'max(contains(a))'
300 $ log 'max(contains(a))'
296 5
301 5
297 $ log 'min(contains(a))'
302 $ log 'min(contains(a))'
298 0
303 0
299 $ log 'merge()'
304 $ log 'merge()'
300 6
305 6
301 $ log 'modifies(b)'
306 $ log 'modifies(b)'
302 4
307 4
303 $ log 'id(5)'
308 $ log 'id(5)'
304 2
309 2
305 $ log 'outgoing()'
310 $ log 'outgoing()'
306 8
311 8
307 9
312 9
308 $ log 'outgoing("../remote1")'
313 $ log 'outgoing("../remote1")'
309 8
314 8
310 9
315 9
311 $ log 'outgoing("../remote2")'
316 $ log 'outgoing("../remote2")'
312 3
317 3
313 5
318 5
314 6
319 6
315 7
320 7
316 9
321 9
317 $ log 'p1(merge())'
322 $ log 'p1(merge())'
318 5
323 5
319 $ log 'p2(merge())'
324 $ log 'p2(merge())'
320 4
325 4
321 $ log 'parents(merge())'
326 $ log 'parents(merge())'
322 4
327 4
323 5
328 5
324 $ log 'removes(a)'
329 $ log 'removes(a)'
325 2
330 2
326 6
331 6
327 $ log 'roots(all())'
332 $ log 'roots(all())'
328 0
333 0
329 $ log 'reverse(2 or 3 or 4 or 5)'
334 $ log 'reverse(2 or 3 or 4 or 5)'
330 5
335 5
331 4
336 4
332 3
337 3
333 2
338 2
334 $ log 'rev(5)'
339 $ log 'rev(5)'
335 5
340 5
336 $ log 'sort(limit(reverse(all()), 3))'
341 $ log 'sort(limit(reverse(all()), 3))'
337 7
342 7
338 8
343 8
339 9
344 9
340 $ log 'sort(2 or 3 or 4 or 5, date)'
345 $ log 'sort(2 or 3 or 4 or 5, date)'
341 2
346 2
342 3
347 3
343 5
348 5
344 4
349 4
345 $ log 'tagged()'
350 $ log 'tagged()'
346 6
351 6
347 $ log 'tag()'
352 $ log 'tag()'
348 6
353 6
349 $ log 'tag(1.0)'
354 $ log 'tag(1.0)'
350 6
355 6
351 $ log 'tag(tip)'
356 $ log 'tag(tip)'
352 9
357 9
353 $ log 'tag(unknown)'
358 $ log 'tag(unknown)'
354 abort: tag 'unknown' does not exist
359 abort: tag 'unknown' does not exist
355 [255]
360 [255]
356 $ log 'branch(unknown)'
361 $ log 'branch(unknown)'
357 abort: unknown revision 'unknown'!
362 abort: unknown revision 'unknown'!
358 [255]
363 [255]
359 $ log 'user(bob)'
364 $ log 'user(bob)'
360 2
365 2
361
366
362 $ log '4::8'
367 $ log '4::8'
363 4
368 4
364 8
369 8
365 $ log '4:8'
370 $ log '4:8'
366 4
371 4
367 5
372 5
368 6
373 6
369 7
374 7
370 8
375 8
371
376
372 $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
377 $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")'
373 4
378 4
374 2
379 2
375 5
380 5
376
381
377 $ log 'not 0 and 0:2'
382 $ log 'not 0 and 0:2'
378 1
383 1
379 2
384 2
380 $ log 'not 1 and 0:2'
385 $ log 'not 1 and 0:2'
381 0
386 0
382 2
387 2
383 $ log 'not 2 and 0:2'
388 $ log 'not 2 and 0:2'
384 0
389 0
385 1
390 1
386 $ log '(1 and 2)::'
391 $ log '(1 and 2)::'
387 $ log '(1 and 2):'
392 $ log '(1 and 2):'
388 $ log '(1 and 2):3'
393 $ log '(1 and 2):3'
389 $ log 'sort(head(), -rev)'
394 $ log 'sort(head(), -rev)'
390 9
395 9
391 7
396 7
392 6
397 6
393 5
398 5
394 4
399 4
395 3
400 3
396 2
401 2
397 1
402 1
398 0
403 0
399 $ log '4::8 - 8'
404 $ log '4::8 - 8'
400 4
405 4
401
406
402 issue2437
407 issue2437
403
408
404 $ log '3 and p1(5)'
409 $ log '3 and p1(5)'
405 3
410 3
406 $ log '4 and p2(6)'
411 $ log '4 and p2(6)'
407 4
412 4
408 $ log '1 and parents(:2)'
413 $ log '1 and parents(:2)'
409 1
414 1
410 $ log '2 and children(1:)'
415 $ log '2 and children(1:)'
411 2
416 2
412 $ log 'roots(all()) or roots(all())'
417 $ log 'roots(all()) or roots(all())'
413 0
418 0
414 $ hg debugrevspec 'roots(all()) or roots(all())'
419 $ hg debugrevspec 'roots(all()) or roots(all())'
415 0
420 0
416 $ log 'heads(branch(Γ©)) or heads(branch(Γ©))'
421 $ log 'heads(branch(Γ©)) or heads(branch(Γ©))'
417 9
422 9
418 $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))'
423 $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))'
419 4
424 4
420
425
421 issue2654: report a parse error if the revset was not completely parsed
426 issue2654: report a parse error if the revset was not completely parsed
422
427
423 $ log '1 OR 2'
428 $ log '1 OR 2'
424 hg: parse error at 2: invalid token
429 hg: parse error at 2: invalid token
425 [255]
430 [255]
426
431
427 or operator should preserve ordering:
432 or operator should preserve ordering:
428 $ log 'reverse(2::4) or tip'
433 $ log 'reverse(2::4) or tip'
429 4
434 4
430 2
435 2
431 9
436 9
432
437
433 parentrevspec
438 parentrevspec
434
439
435 $ log 'merge()^0'
440 $ log 'merge()^0'
436 6
441 6
437 $ log 'merge()^'
442 $ log 'merge()^'
438 5
443 5
439 $ log 'merge()^1'
444 $ log 'merge()^1'
440 5
445 5
441 $ log 'merge()^2'
446 $ log 'merge()^2'
442 4
447 4
443 $ log 'merge()^^'
448 $ log 'merge()^^'
444 3
449 3
445 $ log 'merge()^1^'
450 $ log 'merge()^1^'
446 3
451 3
447 $ log 'merge()^^^'
452 $ log 'merge()^^^'
448 1
453 1
449
454
450 $ log 'merge()~0'
455 $ log 'merge()~0'
451 6
456 6
452 $ log 'merge()~1'
457 $ log 'merge()~1'
453 5
458 5
454 $ log 'merge()~2'
459 $ log 'merge()~2'
455 3
460 3
456 $ log 'merge()~2^1'
461 $ log 'merge()~2^1'
457 1
462 1
458 $ log 'merge()~3'
463 $ log 'merge()~3'
459 1
464 1
460
465
461 $ log '(-3:tip)^'
466 $ log '(-3:tip)^'
462 4
467 4
463 6
468 6
464 8
469 8
465
470
466 $ log 'tip^foo'
471 $ log 'tip^foo'
467 hg: parse error: ^ expects a number 0, 1, or 2
472 hg: parse error: ^ expects a number 0, 1, or 2
468 [255]
473 [255]
469
474
470 aliases:
475 aliases:
471
476
472 $ echo '[revsetalias]' >> .hg/hgrc
477 $ echo '[revsetalias]' >> .hg/hgrc
473 $ echo 'm = merge()' >> .hg/hgrc
478 $ echo 'm = merge()' >> .hg/hgrc
474 $ echo 'sincem = descendants(m)' >> .hg/hgrc
479 $ echo 'sincem = descendants(m)' >> .hg/hgrc
475 $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
480 $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
476 $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
481 $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
477 $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
482 $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
478
483
479 $ try m
484 $ try m
480 ('symbol', 'm')
485 ('symbol', 'm')
481 (func
486 (func
482 ('symbol', 'merge')
487 ('symbol', 'merge')
483 None)
488 None)
484 6
489 6
485
490
486 test alias recursion
491 test alias recursion
487
492
488 $ try sincem
493 $ try sincem
489 ('symbol', 'sincem')
494 ('symbol', 'sincem')
490 (func
495 (func
491 ('symbol', 'descendants')
496 ('symbol', 'descendants')
492 (func
497 (func
493 ('symbol', 'merge')
498 ('symbol', 'merge')
494 None))
499 None))
495 6
500 6
496 7
501 7
497
502
498 test infinite recursion
503 test infinite recursion
499
504
500 $ echo 'recurse1 = recurse2' >> .hg/hgrc
505 $ echo 'recurse1 = recurse2' >> .hg/hgrc
501 $ echo 'recurse2 = recurse1' >> .hg/hgrc
506 $ echo 'recurse2 = recurse1' >> .hg/hgrc
502 $ try recurse1
507 $ try recurse1
503 ('symbol', 'recurse1')
508 ('symbol', 'recurse1')
504 hg: parse error: infinite expansion of revset alias "recurse1" detected
509 hg: parse error: infinite expansion of revset alias "recurse1" detected
505 [255]
510 [255]
506
511
507 test nesting and variable passing
512 test nesting and variable passing
508
513
509 $ echo 'nested($1) = nested2($1)' >> .hg/hgrc
514 $ echo 'nested($1) = nested2($1)' >> .hg/hgrc
510 $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc
515 $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc
511 $ echo 'nested3($1) = max($1)' >> .hg/hgrc
516 $ echo 'nested3($1) = max($1)' >> .hg/hgrc
512 $ try 'nested(2:5)'
517 $ try 'nested(2:5)'
513 (func
518 (func
514 ('symbol', 'nested')
519 ('symbol', 'nested')
515 (range
520 (range
516 ('symbol', '2')
521 ('symbol', '2')
517 ('symbol', '5')))
522 ('symbol', '5')))
518 (func
523 (func
519 ('symbol', 'max')
524 ('symbol', 'max')
520 (range
525 (range
521 ('symbol', '2')
526 ('symbol', '2')
522 ('symbol', '5')))
527 ('symbol', '5')))
523 5
528 5
524
529
525 test variable isolation, variable placeholders are rewritten as string
530 test variable isolation, variable placeholders are rewritten as string
526 then parsed and matched again as string. Check they do not leak too
531 then parsed and matched again as string. Check they do not leak too
527 far away.
532 far away.
528
533
529 $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc
534 $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc
530 $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc
535 $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc
531 $ try 'callinjection(2:5)'
536 $ try 'callinjection(2:5)'
532 (func
537 (func
533 ('symbol', 'callinjection')
538 ('symbol', 'callinjection')
534 (range
539 (range
535 ('symbol', '2')
540 ('symbol', '2')
536 ('symbol', '5')))
541 ('symbol', '5')))
537 (func
542 (func
538 ('symbol', 'descendants')
543 ('symbol', 'descendants')
539 (func
544 (func
540 ('symbol', 'max')
545 ('symbol', 'max')
541 ('string', '$1')))
546 ('string', '$1')))
542 abort: unknown revision '$1'!
547 abort: unknown revision '$1'!
543 [255]
548 [255]
544
549
545 $ try 'd(2:5)'
550 $ try 'd(2:5)'
546 (func
551 (func
547 ('symbol', 'd')
552 ('symbol', 'd')
548 (range
553 (range
549 ('symbol', '2')
554 ('symbol', '2')
550 ('symbol', '5')))
555 ('symbol', '5')))
551 (func
556 (func
552 ('symbol', 'reverse')
557 ('symbol', 'reverse')
553 (func
558 (func
554 ('symbol', 'sort')
559 ('symbol', 'sort')
555 (list
560 (list
556 (range
561 (range
557 ('symbol', '2')
562 ('symbol', '2')
558 ('symbol', '5'))
563 ('symbol', '5'))
559 ('symbol', 'date'))))
564 ('symbol', 'date'))))
560 4
565 4
561 5
566 5
562 3
567 3
563 2
568 2
564 $ try 'rs(2 or 3, date)'
569 $ try 'rs(2 or 3, date)'
565 (func
570 (func
566 ('symbol', 'rs')
571 ('symbol', 'rs')
567 (list
572 (list
568 (or
573 (or
569 ('symbol', '2')
574 ('symbol', '2')
570 ('symbol', '3'))
575 ('symbol', '3'))
571 ('symbol', 'date')))
576 ('symbol', 'date')))
572 (func
577 (func
573 ('symbol', 'reverse')
578 ('symbol', 'reverse')
574 (func
579 (func
575 ('symbol', 'sort')
580 ('symbol', 'sort')
576 (list
581 (list
577 (or
582 (or
578 ('symbol', '2')
583 ('symbol', '2')
579 ('symbol', '3'))
584 ('symbol', '3'))
580 ('symbol', 'date'))))
585 ('symbol', 'date'))))
581 3
586 3
582 2
587 2
583 $ try 'rs()'
588 $ try 'rs()'
584 (func
589 (func
585 ('symbol', 'rs')
590 ('symbol', 'rs')
586 None)
591 None)
587 hg: parse error: invalid number of arguments: 0
592 hg: parse error: invalid number of arguments: 0
588 [255]
593 [255]
589 $ try 'rs(2)'
594 $ try 'rs(2)'
590 (func
595 (func
591 ('symbol', 'rs')
596 ('symbol', 'rs')
592 ('symbol', '2'))
597 ('symbol', '2'))
593 hg: parse error: invalid number of arguments: 1
598 hg: parse error: invalid number of arguments: 1
594 [255]
599 [255]
595 $ try 'rs(2, data, 7)'
600 $ try 'rs(2, data, 7)'
596 (func
601 (func
597 ('symbol', 'rs')
602 ('symbol', 'rs')
598 (list
603 (list
599 (list
604 (list
600 ('symbol', '2')
605 ('symbol', '2')
601 ('symbol', 'data'))
606 ('symbol', 'data'))
602 ('symbol', '7')))
607 ('symbol', '7')))
603 hg: parse error: invalid number of arguments: 3
608 hg: parse error: invalid number of arguments: 3
604 [255]
609 [255]
605 $ try 'rs4(2 or 3, x, x, date)'
610 $ try 'rs4(2 or 3, x, x, date)'
606 (func
611 (func
607 ('symbol', 'rs4')
612 ('symbol', 'rs4')
608 (list
613 (list
609 (list
614 (list
610 (list
615 (list
611 (or
616 (or
612 ('symbol', '2')
617 ('symbol', '2')
613 ('symbol', '3'))
618 ('symbol', '3'))
614 ('symbol', 'x'))
619 ('symbol', 'x'))
615 ('symbol', 'x'))
620 ('symbol', 'x'))
616 ('symbol', 'date')))
621 ('symbol', 'date')))
617 (func
622 (func
618 ('symbol', 'reverse')
623 ('symbol', 'reverse')
619 (func
624 (func
620 ('symbol', 'sort')
625 ('symbol', 'sort')
621 (list
626 (list
622 (or
627 (or
623 ('symbol', '2')
628 ('symbol', '2')
624 ('symbol', '3'))
629 ('symbol', '3'))
625 ('symbol', 'date'))))
630 ('symbol', 'date'))))
626 3
631 3
627 2
632 2
628
633
629 issue2549 - correct optimizations
634 issue2549 - correct optimizations
630
635
631 $ log 'limit(1 or 2 or 3, 2) and not 2'
636 $ log 'limit(1 or 2 or 3, 2) and not 2'
632 1
637 1
633 $ log 'max(1 or 2) and not 2'
638 $ log 'max(1 or 2) and not 2'
634 $ log 'min(1 or 2) and not 1'
639 $ log 'min(1 or 2) and not 1'
635 $ log 'last(1 or 2, 1) and not 2'
640 $ log 'last(1 or 2, 1) and not 2'
636
641
637 tests for 'remote()' predicate:
642 tests for 'remote()' predicate:
638 #. (csets in remote) (id) (remote)
643 #. (csets in remote) (id) (remote)
639 1. less than local current branch "default"
644 1. less than local current branch "default"
640 2. same with local specified "default"
645 2. same with local specified "default"
641 3. more than local specified specified
646 3. more than local specified specified
642
647
643 $ hg clone --quiet -U . ../remote3
648 $ hg clone --quiet -U . ../remote3
644 $ cd ../remote3
649 $ cd ../remote3
645 $ hg update -q 7
650 $ hg update -q 7
646 $ echo r > r
651 $ echo r > r
647 $ hg ci -Aqm 10
652 $ hg ci -Aqm 10
648 $ log 'remote()'
653 $ log 'remote()'
649 7
654 7
650 $ log 'remote("a-b-c-")'
655 $ log 'remote("a-b-c-")'
651 2
656 2
652 $ cd ../repo
657 $ cd ../repo
653 $ log 'remote(".a.b.c.", "../remote3")'
658 $ log 'remote(".a.b.c.", "../remote3")'
654
659
655 $ cd ..
660 $ cd ..
656
661
657 test author/desc/keyword in problematic encoding
662 test author/desc/keyword in problematic encoding
658 # unicode: cp932:
663 # unicode: cp932:
659 # u30A2 0x83 0x41(= 'A')
664 # u30A2 0x83 0x41(= 'A')
660 # u30C2 0x83 0x61(= 'a')
665 # u30C2 0x83 0x61(= 'a')
661
666
662 $ hg init problematicencoding
667 $ hg init problematicencoding
663 $ cd problematicencoding
668 $ cd problematicencoding
664
669
665 $ python > setup.sh <<EOF
670 $ python > setup.sh <<EOF
666 > print u'''
671 > print u'''
667 > echo a > text
672 > echo a > text
668 > hg add text
673 > hg add text
669 > hg --encoding utf-8 commit -u '\u30A2' -m none
674 > hg --encoding utf-8 commit -u '\u30A2' -m none
670 > echo b > text
675 > echo b > text
671 > hg --encoding utf-8 commit -u '\u30C2' -m none
676 > hg --encoding utf-8 commit -u '\u30C2' -m none
672 > echo c > text
677 > echo c > text
673 > hg --encoding utf-8 commit -u none -m '\u30A2'
678 > hg --encoding utf-8 commit -u none -m '\u30A2'
674 > echo d > text
679 > echo d > text
675 > hg --encoding utf-8 commit -u none -m '\u30C2'
680 > hg --encoding utf-8 commit -u none -m '\u30C2'
676 > '''.encode('utf-8')
681 > '''.encode('utf-8')
677 > EOF
682 > EOF
678 $ sh < setup.sh
683 $ sh < setup.sh
679
684
680 test in problematic encoding
685 test in problematic encoding
681 $ python > test.sh <<EOF
686 $ python > test.sh <<EOF
682 > print u'''
687 > print u'''
683 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
688 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
684 > echo ====
689 > echo ====
685 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
690 > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
686 > echo ====
691 > echo ====
687 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
692 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)'
688 > echo ====
693 > echo ====
689 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
694 > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)'
690 > echo ====
695 > echo ====
691 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
696 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
692 > echo ====
697 > echo ====
693 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
698 > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
694 > '''.encode('cp932')
699 > '''.encode('cp932')
695 > EOF
700 > EOF
696 $ sh < test.sh
701 $ sh < test.sh
697 0
702 0
698 ====
703 ====
699 1
704 1
700 ====
705 ====
701 2
706 2
702 ====
707 ====
703 3
708 3
704 ====
709 ====
705 0
710 0
706 2
711 2
707 ====
712 ====
708 1
713 1
709 3
714 3
710
715
711 $ cd ..
716 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now