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