Show More
@@ -1,2322 +1,2343 | |||
|
1 | 1 | $ HGENCODING=utf-8 |
|
2 | 2 | $ export HGENCODING |
|
3 | 3 | $ cat > testrevset.py << EOF |
|
4 | 4 | > import mercurial.revset |
|
5 | 5 | > |
|
6 | 6 | > baseset = mercurial.revset.baseset |
|
7 | 7 | > |
|
8 | 8 | > def r3232(repo, subset, x): |
|
9 | 9 | > """"simple revset that return [3,2,3,2] |
|
10 | 10 | > |
|
11 | 11 | > revisions duplicated on purpose. |
|
12 | 12 | > """ |
|
13 | 13 | > if 3 not in subset: |
|
14 | 14 | > if 2 in subset: |
|
15 | 15 | > return baseset([2,2]) |
|
16 | 16 | > return baseset() |
|
17 | 17 | > return baseset([3,3,2,2]) |
|
18 | 18 | > |
|
19 | 19 | > mercurial.revset.symbols['r3232'] = r3232 |
|
20 | 20 | > EOF |
|
21 | 21 | $ cat >> $HGRCPATH << EOF |
|
22 | 22 | > [extensions] |
|
23 | 23 | > testrevset=$TESTTMP/testrevset.py |
|
24 | 24 | > EOF |
|
25 | 25 | |
|
26 | 26 | $ try() { |
|
27 | 27 | > hg debugrevspec --debug "$@" |
|
28 | 28 | > } |
|
29 | 29 | |
|
30 | 30 | $ log() { |
|
31 | 31 | > hg log --template '{rev}\n' -r "$1" |
|
32 | 32 | > } |
|
33 | 33 | |
|
34 | 34 | $ hg init repo |
|
35 | 35 | $ cd repo |
|
36 | 36 | |
|
37 | 37 | $ echo a > a |
|
38 | 38 | $ hg branch a |
|
39 | 39 | marked working directory as branch a |
|
40 | 40 | (branches are permanent and global, did you want a bookmark?) |
|
41 | 41 | $ hg ci -Aqm0 |
|
42 | 42 | |
|
43 | 43 | $ echo b > b |
|
44 | 44 | $ hg branch b |
|
45 | 45 | marked working directory as branch b |
|
46 | 46 | $ hg ci -Aqm1 |
|
47 | 47 | |
|
48 | 48 | $ rm a |
|
49 | 49 | $ hg branch a-b-c- |
|
50 | 50 | marked working directory as branch a-b-c- |
|
51 | 51 | $ hg ci -Aqm2 -u Bob |
|
52 | 52 | |
|
53 | 53 | $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n' |
|
54 | 54 | 2 |
|
55 | 55 | $ hg log -r "extra('branch')" --template '{rev}\n' |
|
56 | 56 | 0 |
|
57 | 57 | 1 |
|
58 | 58 | 2 |
|
59 | 59 | $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n' |
|
60 | 60 | 0 a |
|
61 | 61 | 2 a-b-c- |
|
62 | 62 | |
|
63 | 63 | $ hg co 1 |
|
64 | 64 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
65 | 65 | $ hg branch +a+b+c+ |
|
66 | 66 | marked working directory as branch +a+b+c+ |
|
67 | 67 | $ hg ci -Aqm3 |
|
68 | 68 | |
|
69 | 69 | $ hg co 2 # interleave |
|
70 | 70 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
71 | 71 | $ echo bb > b |
|
72 | 72 | $ hg branch -- -a-b-c- |
|
73 | 73 | marked working directory as branch -a-b-c- |
|
74 | 74 | $ hg ci -Aqm4 -d "May 12 2005" |
|
75 | 75 | |
|
76 | 76 | $ hg co 3 |
|
77 | 77 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
78 | 78 | $ hg branch !a/b/c/ |
|
79 | 79 | marked working directory as branch !a/b/c/ |
|
80 | 80 | $ hg ci -Aqm"5 bug" |
|
81 | 81 | |
|
82 | 82 | $ hg merge 4 |
|
83 | 83 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
84 | 84 | (branch merge, don't forget to commit) |
|
85 | 85 | $ hg branch _a_b_c_ |
|
86 | 86 | marked working directory as branch _a_b_c_ |
|
87 | 87 | $ hg ci -Aqm"6 issue619" |
|
88 | 88 | |
|
89 | 89 | $ hg branch .a.b.c. |
|
90 | 90 | marked working directory as branch .a.b.c. |
|
91 | 91 | $ hg ci -Aqm7 |
|
92 | 92 | |
|
93 | 93 | $ hg branch all |
|
94 | 94 | marked working directory as branch all |
|
95 | 95 | |
|
96 | 96 | $ hg co 4 |
|
97 | 97 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 98 | $ hg branch Γ© |
|
99 | 99 | marked working directory as branch \xc3\xa9 (esc) |
|
100 | 100 | $ hg ci -Aqm9 |
|
101 | 101 | |
|
102 | 102 | $ hg tag -r6 1.0 |
|
103 | 103 | $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
104 | 104 | |
|
105 | 105 | $ hg clone --quiet -U -r 7 . ../remote1 |
|
106 | 106 | $ hg clone --quiet -U -r 8 . ../remote2 |
|
107 | 107 | $ echo "[paths]" >> .hg/hgrc |
|
108 | 108 | $ echo "default = ../remote1" >> .hg/hgrc |
|
109 | 109 | |
|
110 | 110 | trivial |
|
111 | 111 | |
|
112 | 112 | $ try 0:1 |
|
113 | 113 | (range |
|
114 | 114 | ('symbol', '0') |
|
115 | 115 | ('symbol', '1')) |
|
116 | 116 | * set: |
|
117 | 117 | <spanset+ 0:1> |
|
118 | 118 | 0 |
|
119 | 119 | 1 |
|
120 | 120 | $ try --optimize : |
|
121 | 121 | (rangeall |
|
122 | 122 | None) |
|
123 | 123 | * optimized: |
|
124 | 124 | (range |
|
125 | 125 | ('string', '0') |
|
126 | 126 | ('string', 'tip')) |
|
127 | 127 | * set: |
|
128 | 128 | <spanset+ 0:9> |
|
129 | 129 | 0 |
|
130 | 130 | 1 |
|
131 | 131 | 2 |
|
132 | 132 | 3 |
|
133 | 133 | 4 |
|
134 | 134 | 5 |
|
135 | 135 | 6 |
|
136 | 136 | 7 |
|
137 | 137 | 8 |
|
138 | 138 | 9 |
|
139 | 139 | $ try 3::6 |
|
140 | 140 | (dagrange |
|
141 | 141 | ('symbol', '3') |
|
142 | 142 | ('symbol', '6')) |
|
143 | 143 | * set: |
|
144 | 144 | <baseset+ [3, 5, 6]> |
|
145 | 145 | 3 |
|
146 | 146 | 5 |
|
147 | 147 | 6 |
|
148 | 148 | $ try '0|1|2' |
|
149 | 149 | (or |
|
150 | 150 | ('symbol', '0') |
|
151 | 151 | ('symbol', '1') |
|
152 | 152 | ('symbol', '2')) |
|
153 | 153 | * set: |
|
154 | 154 | <baseset [0, 1, 2]> |
|
155 | 155 | 0 |
|
156 | 156 | 1 |
|
157 | 157 | 2 |
|
158 | 158 | |
|
159 | 159 | names that should work without quoting |
|
160 | 160 | |
|
161 | 161 | $ try a |
|
162 | 162 | ('symbol', 'a') |
|
163 | 163 | * set: |
|
164 | 164 | <baseset [0]> |
|
165 | 165 | 0 |
|
166 | 166 | $ try b-a |
|
167 | 167 | (minus |
|
168 | 168 | ('symbol', 'b') |
|
169 | 169 | ('symbol', 'a')) |
|
170 | 170 | * set: |
|
171 | 171 | <filteredset |
|
172 | 172 | <baseset [1]>, |
|
173 | 173 | <not |
|
174 | 174 | <baseset [0]>>> |
|
175 | 175 | 1 |
|
176 | 176 | $ try _a_b_c_ |
|
177 | 177 | ('symbol', '_a_b_c_') |
|
178 | 178 | * set: |
|
179 | 179 | <baseset [6]> |
|
180 | 180 | 6 |
|
181 | 181 | $ try _a_b_c_-a |
|
182 | 182 | (minus |
|
183 | 183 | ('symbol', '_a_b_c_') |
|
184 | 184 | ('symbol', 'a')) |
|
185 | 185 | * set: |
|
186 | 186 | <filteredset |
|
187 | 187 | <baseset [6]>, |
|
188 | 188 | <not |
|
189 | 189 | <baseset [0]>>> |
|
190 | 190 | 6 |
|
191 | 191 | $ try .a.b.c. |
|
192 | 192 | ('symbol', '.a.b.c.') |
|
193 | 193 | * set: |
|
194 | 194 | <baseset [7]> |
|
195 | 195 | 7 |
|
196 | 196 | $ try .a.b.c.-a |
|
197 | 197 | (minus |
|
198 | 198 | ('symbol', '.a.b.c.') |
|
199 | 199 | ('symbol', 'a')) |
|
200 | 200 | * set: |
|
201 | 201 | <filteredset |
|
202 | 202 | <baseset [7]>, |
|
203 | 203 | <not |
|
204 | 204 | <baseset [0]>>> |
|
205 | 205 | 7 |
|
206 | 206 | |
|
207 | 207 | names that should be caught by fallback mechanism |
|
208 | 208 | |
|
209 | 209 | $ try -- '-a-b-c-' |
|
210 | 210 | ('symbol', '-a-b-c-') |
|
211 | 211 | * set: |
|
212 | 212 | <baseset [4]> |
|
213 | 213 | 4 |
|
214 | 214 | $ log -a-b-c- |
|
215 | 215 | 4 |
|
216 | 216 | $ try '+a+b+c+' |
|
217 | 217 | ('symbol', '+a+b+c+') |
|
218 | 218 | * set: |
|
219 | 219 | <baseset [3]> |
|
220 | 220 | 3 |
|
221 | 221 | $ try '+a+b+c+:' |
|
222 | 222 | (rangepost |
|
223 | 223 | ('symbol', '+a+b+c+')) |
|
224 | 224 | * set: |
|
225 | 225 | <spanset+ 3:9> |
|
226 | 226 | 3 |
|
227 | 227 | 4 |
|
228 | 228 | 5 |
|
229 | 229 | 6 |
|
230 | 230 | 7 |
|
231 | 231 | 8 |
|
232 | 232 | 9 |
|
233 | 233 | $ try ':+a+b+c+' |
|
234 | 234 | (rangepre |
|
235 | 235 | ('symbol', '+a+b+c+')) |
|
236 | 236 | * set: |
|
237 | 237 | <spanset+ 0:3> |
|
238 | 238 | 0 |
|
239 | 239 | 1 |
|
240 | 240 | 2 |
|
241 | 241 | 3 |
|
242 | 242 | $ try -- '-a-b-c-:+a+b+c+' |
|
243 | 243 | (range |
|
244 | 244 | ('symbol', '-a-b-c-') |
|
245 | 245 | ('symbol', '+a+b+c+')) |
|
246 | 246 | * set: |
|
247 | 247 | <spanset- 3:4> |
|
248 | 248 | 4 |
|
249 | 249 | 3 |
|
250 | 250 | $ log '-a-b-c-:+a+b+c+' |
|
251 | 251 | 4 |
|
252 | 252 | 3 |
|
253 | 253 | |
|
254 | 254 | $ try -- -a-b-c--a # complains |
|
255 | 255 | (minus |
|
256 | 256 | (minus |
|
257 | 257 | (minus |
|
258 | 258 | (negate |
|
259 | 259 | ('symbol', 'a')) |
|
260 | 260 | ('symbol', 'b')) |
|
261 | 261 | ('symbol', 'c')) |
|
262 | 262 | (negate |
|
263 | 263 | ('symbol', 'a'))) |
|
264 | 264 | abort: unknown revision '-a'! |
|
265 | 265 | [255] |
|
266 | 266 | $ try Γ© |
|
267 | 267 | ('symbol', '\xc3\xa9') |
|
268 | 268 | * set: |
|
269 | 269 | <baseset [9]> |
|
270 | 270 | 9 |
|
271 | 271 | |
|
272 | 272 | no quoting needed |
|
273 | 273 | |
|
274 | 274 | $ log ::a-b-c- |
|
275 | 275 | 0 |
|
276 | 276 | 1 |
|
277 | 277 | 2 |
|
278 | 278 | |
|
279 | 279 | quoting needed |
|
280 | 280 | |
|
281 | 281 | $ try '"-a-b-c-"-a' |
|
282 | 282 | (minus |
|
283 | 283 | ('string', '-a-b-c-') |
|
284 | 284 | ('symbol', 'a')) |
|
285 | 285 | * set: |
|
286 | 286 | <filteredset |
|
287 | 287 | <baseset [4]>, |
|
288 | 288 | <not |
|
289 | 289 | <baseset [0]>>> |
|
290 | 290 | 4 |
|
291 | 291 | |
|
292 | 292 | $ log '1 or 2' |
|
293 | 293 | 1 |
|
294 | 294 | 2 |
|
295 | 295 | $ log '1|2' |
|
296 | 296 | 1 |
|
297 | 297 | 2 |
|
298 | 298 | $ log '1 and 2' |
|
299 | 299 | $ log '1&2' |
|
300 | 300 | $ try '1&2|3' # precedence - and is higher |
|
301 | 301 | (or |
|
302 | 302 | (and |
|
303 | 303 | ('symbol', '1') |
|
304 | 304 | ('symbol', '2')) |
|
305 | 305 | ('symbol', '3')) |
|
306 | 306 | * set: |
|
307 | 307 | <addset |
|
308 | 308 | <baseset []>, |
|
309 | 309 | <baseset [3]>> |
|
310 | 310 | 3 |
|
311 | 311 | $ try '1|2&3' |
|
312 | 312 | (or |
|
313 | 313 | ('symbol', '1') |
|
314 | 314 | (and |
|
315 | 315 | ('symbol', '2') |
|
316 | 316 | ('symbol', '3'))) |
|
317 | 317 | * set: |
|
318 | 318 | <addset |
|
319 | 319 | <baseset [1]>, |
|
320 | 320 | <baseset []>> |
|
321 | 321 | 1 |
|
322 | 322 | $ try '1&2&3' # associativity |
|
323 | 323 | (and |
|
324 | 324 | (and |
|
325 | 325 | ('symbol', '1') |
|
326 | 326 | ('symbol', '2')) |
|
327 | 327 | ('symbol', '3')) |
|
328 | 328 | * set: |
|
329 | 329 | <baseset []> |
|
330 | 330 | $ try '1|(2|3)' |
|
331 | 331 | (or |
|
332 | 332 | ('symbol', '1') |
|
333 | 333 | (group |
|
334 | 334 | (or |
|
335 | 335 | ('symbol', '2') |
|
336 | 336 | ('symbol', '3')))) |
|
337 | 337 | * set: |
|
338 | 338 | <addset |
|
339 | 339 | <baseset [1]>, |
|
340 | 340 | <baseset [2, 3]>> |
|
341 | 341 | 1 |
|
342 | 342 | 2 |
|
343 | 343 | 3 |
|
344 | 344 | $ log '1.0' # tag |
|
345 | 345 | 6 |
|
346 | 346 | $ log 'a' # branch |
|
347 | 347 | 0 |
|
348 | 348 | $ log '2785f51ee' |
|
349 | 349 | 0 |
|
350 | 350 | $ log 'date(2005)' |
|
351 | 351 | 4 |
|
352 | 352 | $ log 'date(this is a test)' |
|
353 | 353 | hg: parse error at 10: unexpected token: symbol |
|
354 | 354 | [255] |
|
355 | 355 | $ log 'date()' |
|
356 | 356 | hg: parse error: date requires a string |
|
357 | 357 | [255] |
|
358 | 358 | $ log 'date' |
|
359 | 359 | abort: unknown revision 'date'! |
|
360 | 360 | [255] |
|
361 | 361 | $ log 'date(' |
|
362 | 362 | hg: parse error at 5: not a prefix: end |
|
363 | 363 | [255] |
|
364 | 364 | $ log 'date("\xy")' |
|
365 | 365 | hg: parse error: invalid \x escape |
|
366 | 366 | [255] |
|
367 | 367 | $ log 'date(tip)' |
|
368 | 368 | abort: invalid date: 'tip' |
|
369 | 369 | [255] |
|
370 | 370 | $ log '0:date' |
|
371 | 371 | abort: unknown revision 'date'! |
|
372 | 372 | [255] |
|
373 | 373 | $ log '::"date"' |
|
374 | 374 | abort: unknown revision 'date'! |
|
375 | 375 | [255] |
|
376 | 376 | $ hg book date -r 4 |
|
377 | 377 | $ log '0:date' |
|
378 | 378 | 0 |
|
379 | 379 | 1 |
|
380 | 380 | 2 |
|
381 | 381 | 3 |
|
382 | 382 | 4 |
|
383 | 383 | $ log '::date' |
|
384 | 384 | 0 |
|
385 | 385 | 1 |
|
386 | 386 | 2 |
|
387 | 387 | 4 |
|
388 | 388 | $ log '::"date"' |
|
389 | 389 | 0 |
|
390 | 390 | 1 |
|
391 | 391 | 2 |
|
392 | 392 | 4 |
|
393 | 393 | $ log 'date(2005) and 1::' |
|
394 | 394 | 4 |
|
395 | 395 | $ hg book -d date |
|
396 | 396 | |
|
397 | 397 | keyword arguments |
|
398 | 398 | |
|
399 | 399 | $ log 'extra(branch, value=a)' |
|
400 | 400 | 0 |
|
401 | 401 | |
|
402 | 402 | $ log 'extra(branch, a, b)' |
|
403 | 403 | hg: parse error: extra takes at most 2 arguments |
|
404 | 404 | [255] |
|
405 | 405 | $ log 'extra(a, label=b)' |
|
406 | 406 | hg: parse error: extra got multiple values for keyword argument 'label' |
|
407 | 407 | [255] |
|
408 | 408 | $ log 'extra(label=branch, default)' |
|
409 | 409 | hg: parse error: extra got an invalid argument |
|
410 | 410 | [255] |
|
411 | 411 | $ log 'extra(branch, foo+bar=baz)' |
|
412 | 412 | hg: parse error: extra got an invalid argument |
|
413 | 413 | [255] |
|
414 | 414 | $ log 'extra(unknown=branch)' |
|
415 | 415 | hg: parse error: extra got an unexpected keyword argument 'unknown' |
|
416 | 416 | [255] |
|
417 | 417 | |
|
418 | 418 | $ try 'foo=bar|baz' |
|
419 | 419 | (keyvalue |
|
420 | 420 | ('symbol', 'foo') |
|
421 | 421 | (or |
|
422 | 422 | ('symbol', 'bar') |
|
423 | 423 | ('symbol', 'baz'))) |
|
424 | 424 | hg: parse error: can't use a key-value pair in this context |
|
425 | 425 | [255] |
|
426 | 426 | |
|
427 | 427 | Test that symbols only get parsed as functions if there's an opening |
|
428 | 428 | parenthesis. |
|
429 | 429 | |
|
430 | 430 | $ hg book only -r 9 |
|
431 | 431 | $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark |
|
432 | 432 | 8 |
|
433 | 433 | 9 |
|
434 | 434 | |
|
435 | 435 | ancestor can accept 0 or more arguments |
|
436 | 436 | |
|
437 | 437 | $ log 'ancestor()' |
|
438 | 438 | $ log 'ancestor(1)' |
|
439 | 439 | 1 |
|
440 | 440 | $ log 'ancestor(4,5)' |
|
441 | 441 | 1 |
|
442 | 442 | $ log 'ancestor(4,5) and 4' |
|
443 | 443 | $ log 'ancestor(0,0,1,3)' |
|
444 | 444 | 0 |
|
445 | 445 | $ log 'ancestor(3,1,5,3,5,1)' |
|
446 | 446 | 1 |
|
447 | 447 | $ log 'ancestor(0,1,3,5)' |
|
448 | 448 | 0 |
|
449 | 449 | $ log 'ancestor(1,2,3,4,5)' |
|
450 | 450 | 1 |
|
451 | 451 | |
|
452 | 452 | test ancestors |
|
453 | 453 | |
|
454 | 454 | $ log 'ancestors(5)' |
|
455 | 455 | 0 |
|
456 | 456 | 1 |
|
457 | 457 | 3 |
|
458 | 458 | 5 |
|
459 | 459 | $ log 'ancestor(ancestors(5))' |
|
460 | 460 | 0 |
|
461 | 461 | $ log '::r3232()' |
|
462 | 462 | 0 |
|
463 | 463 | 1 |
|
464 | 464 | 2 |
|
465 | 465 | 3 |
|
466 | 466 | |
|
467 | 467 | $ log 'author(bob)' |
|
468 | 468 | 2 |
|
469 | 469 | $ log 'author("re:bob|test")' |
|
470 | 470 | 0 |
|
471 | 471 | 1 |
|
472 | 472 | 2 |
|
473 | 473 | 3 |
|
474 | 474 | 4 |
|
475 | 475 | 5 |
|
476 | 476 | 6 |
|
477 | 477 | 7 |
|
478 | 478 | 8 |
|
479 | 479 | 9 |
|
480 | 480 | $ log 'branch(Γ©)' |
|
481 | 481 | 8 |
|
482 | 482 | 9 |
|
483 | 483 | $ log 'branch(a)' |
|
484 | 484 | 0 |
|
485 | 485 | $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n' |
|
486 | 486 | 0 a |
|
487 | 487 | 2 a-b-c- |
|
488 | 488 | 3 +a+b+c+ |
|
489 | 489 | 4 -a-b-c- |
|
490 | 490 | 5 !a/b/c/ |
|
491 | 491 | 6 _a_b_c_ |
|
492 | 492 | 7 .a.b.c. |
|
493 | 493 | $ log 'children(ancestor(4,5))' |
|
494 | 494 | 2 |
|
495 | 495 | 3 |
|
496 | 496 | $ log 'closed()' |
|
497 | 497 | $ log 'contains(a)' |
|
498 | 498 | 0 |
|
499 | 499 | 1 |
|
500 | 500 | 3 |
|
501 | 501 | 5 |
|
502 | 502 | $ log 'contains("../repo/a")' |
|
503 | 503 | 0 |
|
504 | 504 | 1 |
|
505 | 505 | 3 |
|
506 | 506 | 5 |
|
507 | 507 | $ log 'desc(B)' |
|
508 | 508 | 5 |
|
509 | 509 | $ log 'descendants(2 or 3)' |
|
510 | 510 | 2 |
|
511 | 511 | 3 |
|
512 | 512 | 4 |
|
513 | 513 | 5 |
|
514 | 514 | 6 |
|
515 | 515 | 7 |
|
516 | 516 | 8 |
|
517 | 517 | 9 |
|
518 | 518 | $ log 'file("b*")' |
|
519 | 519 | 1 |
|
520 | 520 | 4 |
|
521 | 521 | $ log 'filelog("b")' |
|
522 | 522 | 1 |
|
523 | 523 | 4 |
|
524 | 524 | $ log 'filelog("../repo/b")' |
|
525 | 525 | 1 |
|
526 | 526 | 4 |
|
527 | 527 | $ log 'follow()' |
|
528 | 528 | 0 |
|
529 | 529 | 1 |
|
530 | 530 | 2 |
|
531 | 531 | 4 |
|
532 | 532 | 8 |
|
533 | 533 | 9 |
|
534 | 534 | $ log 'grep("issue\d+")' |
|
535 | 535 | 6 |
|
536 | 536 | $ try 'grep("(")' # invalid regular expression |
|
537 | 537 | (func |
|
538 | 538 | ('symbol', 'grep') |
|
539 | 539 | ('string', '(')) |
|
540 | 540 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
541 | 541 | [255] |
|
542 | 542 | $ try 'grep("\bissue\d+")' |
|
543 | 543 | (func |
|
544 | 544 | ('symbol', 'grep') |
|
545 | 545 | ('string', '\x08issue\\d+')) |
|
546 | 546 | * set: |
|
547 | 547 | <filteredset |
|
548 | 548 | <fullreposet+ 0:9>, |
|
549 | 549 | <grep '\x08issue\\d+'>> |
|
550 | 550 | $ try 'grep(r"\bissue\d+")' |
|
551 | 551 | (func |
|
552 | 552 | ('symbol', 'grep') |
|
553 | 553 | ('string', '\\bissue\\d+')) |
|
554 | 554 | * set: |
|
555 | 555 | <filteredset |
|
556 | 556 | <fullreposet+ 0:9>, |
|
557 | 557 | <grep '\\bissue\\d+'>> |
|
558 | 558 | 6 |
|
559 | 559 | $ try 'grep(r"\")' |
|
560 | 560 | hg: parse error at 7: unterminated string |
|
561 | 561 | [255] |
|
562 | 562 | $ log 'head()' |
|
563 | 563 | 0 |
|
564 | 564 | 1 |
|
565 | 565 | 2 |
|
566 | 566 | 3 |
|
567 | 567 | 4 |
|
568 | 568 | 5 |
|
569 | 569 | 6 |
|
570 | 570 | 7 |
|
571 | 571 | 9 |
|
572 | 572 | $ log 'heads(6::)' |
|
573 | 573 | 7 |
|
574 | 574 | $ log 'keyword(issue)' |
|
575 | 575 | 6 |
|
576 | 576 | $ log 'keyword("test a")' |
|
577 | 577 | $ log 'limit(head(), 1)' |
|
578 | 578 | 0 |
|
579 | 579 | $ log 'limit(author("re:bob|test"), 3, 5)' |
|
580 | 580 | 5 |
|
581 | 581 | 6 |
|
582 | 582 | 7 |
|
583 | 583 | $ log 'limit(author("re:bob|test"), offset=6)' |
|
584 | 584 | 6 |
|
585 | 585 | $ log 'limit(author("re:bob|test"), offset=10)' |
|
586 | 586 | $ log 'limit(all(), 1, -1)' |
|
587 | 587 | hg: parse error: negative offset |
|
588 | 588 | [255] |
|
589 | 589 | $ log 'matching(6)' |
|
590 | 590 | 6 |
|
591 | 591 | $ log 'matching(6:7, "phase parents user date branch summary files description substate")' |
|
592 | 592 | 6 |
|
593 | 593 | 7 |
|
594 | 594 | |
|
595 | 595 | Testing min and max |
|
596 | 596 | |
|
597 | 597 | max: simple |
|
598 | 598 | |
|
599 | 599 | $ log 'max(contains(a))' |
|
600 | 600 | 5 |
|
601 | 601 | |
|
602 | 602 | max: simple on unordered set) |
|
603 | 603 | |
|
604 | 604 | $ log 'max((4+0+2+5+7) and contains(a))' |
|
605 | 605 | 5 |
|
606 | 606 | |
|
607 | 607 | max: no result |
|
608 | 608 | |
|
609 | 609 | $ log 'max(contains(stringthatdoesnotappearanywhere))' |
|
610 | 610 | |
|
611 | 611 | max: no result on unordered set |
|
612 | 612 | |
|
613 | 613 | $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' |
|
614 | 614 | |
|
615 | 615 | min: simple |
|
616 | 616 | |
|
617 | 617 | $ log 'min(contains(a))' |
|
618 | 618 | 0 |
|
619 | 619 | |
|
620 | 620 | min: simple on unordered set |
|
621 | 621 | |
|
622 | 622 | $ log 'min((4+0+2+5+7) and contains(a))' |
|
623 | 623 | 0 |
|
624 | 624 | |
|
625 | 625 | min: empty |
|
626 | 626 | |
|
627 | 627 | $ log 'min(contains(stringthatdoesnotappearanywhere))' |
|
628 | 628 | |
|
629 | 629 | min: empty on unordered set |
|
630 | 630 | |
|
631 | 631 | $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' |
|
632 | 632 | |
|
633 | 633 | |
|
634 | 634 | $ log 'merge()' |
|
635 | 635 | 6 |
|
636 | 636 | $ log 'branchpoint()' |
|
637 | 637 | 1 |
|
638 | 638 | 4 |
|
639 | 639 | $ log 'modifies(b)' |
|
640 | 640 | 4 |
|
641 | 641 | $ log 'modifies("path:b")' |
|
642 | 642 | 4 |
|
643 | 643 | $ log 'modifies("*")' |
|
644 | 644 | 4 |
|
645 | 645 | 6 |
|
646 | 646 | $ log 'modifies("set:modified()")' |
|
647 | 647 | 4 |
|
648 | 648 | $ log 'id(5)' |
|
649 | 649 | 2 |
|
650 | 650 | $ log 'only(9)' |
|
651 | 651 | 8 |
|
652 | 652 | 9 |
|
653 | 653 | $ log 'only(8)' |
|
654 | 654 | 8 |
|
655 | 655 | $ log 'only(9, 5)' |
|
656 | 656 | 2 |
|
657 | 657 | 4 |
|
658 | 658 | 8 |
|
659 | 659 | 9 |
|
660 | 660 | $ log 'only(7 + 9, 5 + 2)' |
|
661 | 661 | 4 |
|
662 | 662 | 6 |
|
663 | 663 | 7 |
|
664 | 664 | 8 |
|
665 | 665 | 9 |
|
666 | 666 | |
|
667 | 667 | Test empty set input |
|
668 | 668 | $ log 'only(p2())' |
|
669 | 669 | $ log 'only(p1(), p2())' |
|
670 | 670 | 0 |
|
671 | 671 | 1 |
|
672 | 672 | 2 |
|
673 | 673 | 4 |
|
674 | 674 | 8 |
|
675 | 675 | 9 |
|
676 | 676 | |
|
677 | 677 | Test '%' operator |
|
678 | 678 | |
|
679 | 679 | $ log '9%' |
|
680 | 680 | 8 |
|
681 | 681 | 9 |
|
682 | 682 | $ log '9%5' |
|
683 | 683 | 2 |
|
684 | 684 | 4 |
|
685 | 685 | 8 |
|
686 | 686 | 9 |
|
687 | 687 | $ log '(7 + 9)%(5 + 2)' |
|
688 | 688 | 4 |
|
689 | 689 | 6 |
|
690 | 690 | 7 |
|
691 | 691 | 8 |
|
692 | 692 | 9 |
|
693 | 693 | |
|
694 | 694 | Test opreand of '%' is optimized recursively (issue4670) |
|
695 | 695 | |
|
696 | 696 | $ try --optimize '8:9-8%' |
|
697 | 697 | (onlypost |
|
698 | 698 | (minus |
|
699 | 699 | (range |
|
700 | 700 | ('symbol', '8') |
|
701 | 701 | ('symbol', '9')) |
|
702 | 702 | ('symbol', '8'))) |
|
703 | 703 | * optimized: |
|
704 | 704 | (func |
|
705 | 705 | ('symbol', 'only') |
|
706 | 706 | (difference |
|
707 | 707 | (range |
|
708 | 708 | ('symbol', '8') |
|
709 | 709 | ('symbol', '9')) |
|
710 | 710 | ('symbol', '8'))) |
|
711 | 711 | * set: |
|
712 | 712 | <baseset+ [8, 9]> |
|
713 | 713 | 8 |
|
714 | 714 | 9 |
|
715 | 715 | $ try --optimize '(9)%(5)' |
|
716 | 716 | (only |
|
717 | 717 | (group |
|
718 | 718 | ('symbol', '9')) |
|
719 | 719 | (group |
|
720 | 720 | ('symbol', '5'))) |
|
721 | 721 | * optimized: |
|
722 | 722 | (func |
|
723 | 723 | ('symbol', 'only') |
|
724 | 724 | (list |
|
725 | 725 | ('symbol', '9') |
|
726 | 726 | ('symbol', '5'))) |
|
727 | 727 | * set: |
|
728 | 728 | <baseset+ [8, 9, 2, 4]> |
|
729 | 729 | 2 |
|
730 | 730 | 4 |
|
731 | 731 | 8 |
|
732 | 732 | 9 |
|
733 | 733 | |
|
734 | 734 | Test the order of operations |
|
735 | 735 | |
|
736 | 736 | $ log '7 + 9%5 + 2' |
|
737 | 737 | 7 |
|
738 | 738 | 2 |
|
739 | 739 | 4 |
|
740 | 740 | 8 |
|
741 | 741 | 9 |
|
742 | 742 | |
|
743 | 743 | Test explicit numeric revision |
|
744 | 744 | $ log 'rev(-2)' |
|
745 | 745 | $ log 'rev(-1)' |
|
746 | 746 | -1 |
|
747 | 747 | $ log 'rev(0)' |
|
748 | 748 | 0 |
|
749 | 749 | $ log 'rev(9)' |
|
750 | 750 | 9 |
|
751 | 751 | $ log 'rev(10)' |
|
752 | 752 | $ log 'rev(tip)' |
|
753 | 753 | hg: parse error: rev expects a number |
|
754 | 754 | [255] |
|
755 | 755 | |
|
756 | 756 | Test hexadecimal revision |
|
757 | 757 | $ log 'id(2)' |
|
758 | 758 | abort: 00changelog.i@2: ambiguous identifier! |
|
759 | 759 | [255] |
|
760 | 760 | $ log 'id(23268)' |
|
761 | 761 | 4 |
|
762 | 762 | $ log 'id(2785f51eece)' |
|
763 | 763 | 0 |
|
764 | 764 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)' |
|
765 | 765 | 8 |
|
766 | 766 | $ log 'id(d5d0dcbdc4a)' |
|
767 | 767 | $ log 'id(d5d0dcbdc4w)' |
|
768 | 768 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)' |
|
769 | 769 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)' |
|
770 | 770 | $ log 'id(1.0)' |
|
771 | 771 | $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)' |
|
772 | 772 | |
|
773 | 773 | Test null revision |
|
774 | 774 | $ log '(null)' |
|
775 | 775 | -1 |
|
776 | 776 | $ log '(null:0)' |
|
777 | 777 | -1 |
|
778 | 778 | 0 |
|
779 | 779 | $ log '(0:null)' |
|
780 | 780 | 0 |
|
781 | 781 | -1 |
|
782 | 782 | $ log 'null::0' |
|
783 | 783 | -1 |
|
784 | 784 | 0 |
|
785 | 785 | $ log 'null:tip - 0:' |
|
786 | 786 | -1 |
|
787 | 787 | $ log 'null: and null::' | head -1 |
|
788 | 788 | -1 |
|
789 | 789 | $ log 'null: or 0:' | head -2 |
|
790 | 790 | -1 |
|
791 | 791 | 0 |
|
792 | 792 | $ log 'ancestors(null)' |
|
793 | 793 | -1 |
|
794 | 794 | $ log 'reverse(null:)' | tail -2 |
|
795 | 795 | 0 |
|
796 | 796 | -1 |
|
797 | 797 | BROKEN: should be '-1' |
|
798 | 798 | $ log 'first(null:)' |
|
799 | 799 | BROKEN: should be '-1' |
|
800 | 800 | $ log 'min(null:)' |
|
801 | 801 | $ log 'tip:null and all()' | tail -2 |
|
802 | 802 | 1 |
|
803 | 803 | 0 |
|
804 | 804 | |
|
805 | 805 | Test working-directory revision |
|
806 | 806 | $ hg debugrevspec 'wdir()' |
|
807 | 807 | 2147483647 |
|
808 | 808 | $ hg debugrevspec 'tip or wdir()' |
|
809 | 809 | 9 |
|
810 | 810 | 2147483647 |
|
811 | 811 | $ hg debugrevspec '0:tip and wdir()' |
|
812 | 812 | $ log '0:wdir()' | tail -3 |
|
813 | 813 | 8 |
|
814 | 814 | 9 |
|
815 | 815 | 2147483647 |
|
816 | 816 | $ log 'wdir():0' | head -3 |
|
817 | 817 | 2147483647 |
|
818 | 818 | 9 |
|
819 | 819 | 8 |
|
820 | 820 | $ log 'wdir():wdir()' |
|
821 | 821 | 2147483647 |
|
822 | 822 | $ log '(all() + wdir()) & min(. + wdir())' |
|
823 | 823 | 9 |
|
824 | 824 | $ log '(all() + wdir()) & max(. + wdir())' |
|
825 | 825 | 2147483647 |
|
826 | 826 | $ log '(all() + wdir()) & first(wdir() + .)' |
|
827 | 827 | 2147483647 |
|
828 | 828 | $ log '(all() + wdir()) & last(. + wdir())' |
|
829 | 829 | 2147483647 |
|
830 | 830 | |
|
831 | 831 | $ log 'outgoing()' |
|
832 | 832 | 8 |
|
833 | 833 | 9 |
|
834 | 834 | $ log 'outgoing("../remote1")' |
|
835 | 835 | 8 |
|
836 | 836 | 9 |
|
837 | 837 | $ log 'outgoing("../remote2")' |
|
838 | 838 | 3 |
|
839 | 839 | 5 |
|
840 | 840 | 6 |
|
841 | 841 | 7 |
|
842 | 842 | 9 |
|
843 | 843 | $ log 'p1(merge())' |
|
844 | 844 | 5 |
|
845 | 845 | $ log 'p2(merge())' |
|
846 | 846 | 4 |
|
847 | 847 | $ log 'parents(merge())' |
|
848 | 848 | 4 |
|
849 | 849 | 5 |
|
850 | 850 | $ log 'p1(branchpoint())' |
|
851 | 851 | 0 |
|
852 | 852 | 2 |
|
853 | 853 | $ log 'p2(branchpoint())' |
|
854 | 854 | $ log 'parents(branchpoint())' |
|
855 | 855 | 0 |
|
856 | 856 | 2 |
|
857 | 857 | $ log 'removes(a)' |
|
858 | 858 | 2 |
|
859 | 859 | 6 |
|
860 | 860 | $ log 'roots(all())' |
|
861 | 861 | 0 |
|
862 | 862 | $ log 'reverse(2 or 3 or 4 or 5)' |
|
863 | 863 | 5 |
|
864 | 864 | 4 |
|
865 | 865 | 3 |
|
866 | 866 | 2 |
|
867 | 867 | $ log 'reverse(all())' |
|
868 | 868 | 9 |
|
869 | 869 | 8 |
|
870 | 870 | 7 |
|
871 | 871 | 6 |
|
872 | 872 | 5 |
|
873 | 873 | 4 |
|
874 | 874 | 3 |
|
875 | 875 | 2 |
|
876 | 876 | 1 |
|
877 | 877 | 0 |
|
878 | 878 | $ log 'reverse(all()) & filelog(b)' |
|
879 | 879 | 4 |
|
880 | 880 | 1 |
|
881 | 881 | $ log 'rev(5)' |
|
882 | 882 | 5 |
|
883 | 883 | $ log 'sort(limit(reverse(all()), 3))' |
|
884 | 884 | 7 |
|
885 | 885 | 8 |
|
886 | 886 | 9 |
|
887 | 887 | $ log 'sort(2 or 3 or 4 or 5, date)' |
|
888 | 888 | 2 |
|
889 | 889 | 3 |
|
890 | 890 | 5 |
|
891 | 891 | 4 |
|
892 | 892 | $ log 'tagged()' |
|
893 | 893 | 6 |
|
894 | 894 | $ log 'tag()' |
|
895 | 895 | 6 |
|
896 | 896 | $ log 'tag(1.0)' |
|
897 | 897 | 6 |
|
898 | 898 | $ log 'tag(tip)' |
|
899 | 899 | 9 |
|
900 | 900 | |
|
901 | 901 | test sort revset |
|
902 | 902 | -------------------------------------------- |
|
903 | 903 | |
|
904 | 904 | test when adding two unordered revsets |
|
905 | 905 | |
|
906 | 906 | $ log 'sort(keyword(issue) or modifies(b))' |
|
907 | 907 | 4 |
|
908 | 908 | 6 |
|
909 | 909 | |
|
910 | 910 | test when sorting a reversed collection in the same way it is |
|
911 | 911 | |
|
912 | 912 | $ log 'sort(reverse(all()), -rev)' |
|
913 | 913 | 9 |
|
914 | 914 | 8 |
|
915 | 915 | 7 |
|
916 | 916 | 6 |
|
917 | 917 | 5 |
|
918 | 918 | 4 |
|
919 | 919 | 3 |
|
920 | 920 | 2 |
|
921 | 921 | 1 |
|
922 | 922 | 0 |
|
923 | 923 | |
|
924 | 924 | test when sorting a reversed collection |
|
925 | 925 | |
|
926 | 926 | $ log 'sort(reverse(all()), rev)' |
|
927 | 927 | 0 |
|
928 | 928 | 1 |
|
929 | 929 | 2 |
|
930 | 930 | 3 |
|
931 | 931 | 4 |
|
932 | 932 | 5 |
|
933 | 933 | 6 |
|
934 | 934 | 7 |
|
935 | 935 | 8 |
|
936 | 936 | 9 |
|
937 | 937 | |
|
938 | 938 | |
|
939 | 939 | test sorting two sorted collections in different orders |
|
940 | 940 | |
|
941 | 941 | $ log 'sort(outgoing() or reverse(removes(a)), rev)' |
|
942 | 942 | 2 |
|
943 | 943 | 6 |
|
944 | 944 | 8 |
|
945 | 945 | 9 |
|
946 | 946 | |
|
947 | 947 | test sorting two sorted collections in different orders backwards |
|
948 | 948 | |
|
949 | 949 | $ log 'sort(outgoing() or reverse(removes(a)), -rev)' |
|
950 | 950 | 9 |
|
951 | 951 | 8 |
|
952 | 952 | 6 |
|
953 | 953 | 2 |
|
954 | 954 | |
|
955 | 955 | test subtracting something from an addset |
|
956 | 956 | |
|
957 | 957 | $ log '(outgoing() or removes(a)) - removes(a)' |
|
958 | 958 | 8 |
|
959 | 959 | 9 |
|
960 | 960 | |
|
961 | 961 | test intersecting something with an addset |
|
962 | 962 | |
|
963 | 963 | $ log 'parents(outgoing() or removes(a))' |
|
964 | 964 | 1 |
|
965 | 965 | 4 |
|
966 | 966 | 5 |
|
967 | 967 | 8 |
|
968 | 968 | |
|
969 | 969 | test that `or` operation combines elements in the right order: |
|
970 | 970 | |
|
971 | 971 | $ log '3:4 or 2:5' |
|
972 | 972 | 3 |
|
973 | 973 | 4 |
|
974 | 974 | 2 |
|
975 | 975 | 5 |
|
976 | 976 | $ log '3:4 or 5:2' |
|
977 | 977 | 3 |
|
978 | 978 | 4 |
|
979 | 979 | 5 |
|
980 | 980 | 2 |
|
981 | 981 | $ log 'sort(3:4 or 2:5)' |
|
982 | 982 | 2 |
|
983 | 983 | 3 |
|
984 | 984 | 4 |
|
985 | 985 | 5 |
|
986 | 986 | $ log 'sort(3:4 or 5:2)' |
|
987 | 987 | 2 |
|
988 | 988 | 3 |
|
989 | 989 | 4 |
|
990 | 990 | 5 |
|
991 | 991 | |
|
992 | 992 | test that more than one `-r`s are combined in the right order and deduplicated: |
|
993 | 993 | |
|
994 | 994 | $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)' |
|
995 | 995 | 3 |
|
996 | 996 | 4 |
|
997 | 997 | 5 |
|
998 | 998 | 2 |
|
999 | 999 | 0 |
|
1000 | 1000 | 1 |
|
1001 | 1001 | |
|
1002 | 1002 | test that `or` operation skips duplicated revisions from right-hand side |
|
1003 | 1003 | |
|
1004 | 1004 | $ try 'reverse(1::5) or ancestors(4)' |
|
1005 | 1005 | (or |
|
1006 | 1006 | (func |
|
1007 | 1007 | ('symbol', 'reverse') |
|
1008 | 1008 | (dagrange |
|
1009 | 1009 | ('symbol', '1') |
|
1010 | 1010 | ('symbol', '5'))) |
|
1011 | 1011 | (func |
|
1012 | 1012 | ('symbol', 'ancestors') |
|
1013 | 1013 | ('symbol', '4'))) |
|
1014 | 1014 | * set: |
|
1015 | 1015 | <addset |
|
1016 | 1016 | <baseset- [1, 3, 5]>, |
|
1017 | 1017 | <generatorset+>> |
|
1018 | 1018 | 5 |
|
1019 | 1019 | 3 |
|
1020 | 1020 | 1 |
|
1021 | 1021 | 0 |
|
1022 | 1022 | 2 |
|
1023 | 1023 | 4 |
|
1024 | 1024 | $ try 'sort(ancestors(4) or reverse(1::5))' |
|
1025 | 1025 | (func |
|
1026 | 1026 | ('symbol', 'sort') |
|
1027 | 1027 | (or |
|
1028 | 1028 | (func |
|
1029 | 1029 | ('symbol', 'ancestors') |
|
1030 | 1030 | ('symbol', '4')) |
|
1031 | 1031 | (func |
|
1032 | 1032 | ('symbol', 'reverse') |
|
1033 | 1033 | (dagrange |
|
1034 | 1034 | ('symbol', '1') |
|
1035 | 1035 | ('symbol', '5'))))) |
|
1036 | 1036 | * set: |
|
1037 | 1037 | <addset+ |
|
1038 | 1038 | <generatorset+>, |
|
1039 | 1039 | <baseset- [1, 3, 5]>> |
|
1040 | 1040 | 0 |
|
1041 | 1041 | 1 |
|
1042 | 1042 | 2 |
|
1043 | 1043 | 3 |
|
1044 | 1044 | 4 |
|
1045 | 1045 | 5 |
|
1046 | 1046 | |
|
1047 | 1047 | test optimization of trivial `or` operation |
|
1048 | 1048 | |
|
1049 | 1049 | $ try --optimize '0|(1)|"2"|-2|tip|null' |
|
1050 | 1050 | (or |
|
1051 | 1051 | ('symbol', '0') |
|
1052 | 1052 | (group |
|
1053 | 1053 | ('symbol', '1')) |
|
1054 | 1054 | ('string', '2') |
|
1055 | 1055 | (negate |
|
1056 | 1056 | ('symbol', '2')) |
|
1057 | 1057 | ('symbol', 'tip') |
|
1058 | 1058 | ('symbol', 'null')) |
|
1059 | 1059 | * optimized: |
|
1060 | 1060 | (func |
|
1061 | 1061 | ('symbol', '_list') |
|
1062 | 1062 | ('string', '0\x001\x002\x00-2\x00tip\x00null')) |
|
1063 | 1063 | * set: |
|
1064 | 1064 | <baseset [0, 1, 2, 8, 9, -1]> |
|
1065 | 1065 | 0 |
|
1066 | 1066 | 1 |
|
1067 | 1067 | 2 |
|
1068 | 1068 | 8 |
|
1069 | 1069 | 9 |
|
1070 | 1070 | -1 |
|
1071 | 1071 | |
|
1072 | 1072 | $ try --optimize '0|1|2:3' |
|
1073 | 1073 | (or |
|
1074 | 1074 | ('symbol', '0') |
|
1075 | 1075 | ('symbol', '1') |
|
1076 | 1076 | (range |
|
1077 | 1077 | ('symbol', '2') |
|
1078 | 1078 | ('symbol', '3'))) |
|
1079 | 1079 | * optimized: |
|
1080 | 1080 | (or |
|
1081 | 1081 | (func |
|
1082 | 1082 | ('symbol', '_list') |
|
1083 | 1083 | ('string', '0\x001')) |
|
1084 | 1084 | (range |
|
1085 | 1085 | ('symbol', '2') |
|
1086 | 1086 | ('symbol', '3'))) |
|
1087 | 1087 | * set: |
|
1088 | 1088 | <addset |
|
1089 | 1089 | <baseset [0, 1]>, |
|
1090 | 1090 | <spanset+ 2:3>> |
|
1091 | 1091 | 0 |
|
1092 | 1092 | 1 |
|
1093 | 1093 | 2 |
|
1094 | 1094 | 3 |
|
1095 | 1095 | |
|
1096 | 1096 | $ try --optimize '0:1|2|3:4|5|6' |
|
1097 | 1097 | (or |
|
1098 | 1098 | (range |
|
1099 | 1099 | ('symbol', '0') |
|
1100 | 1100 | ('symbol', '1')) |
|
1101 | 1101 | ('symbol', '2') |
|
1102 | 1102 | (range |
|
1103 | 1103 | ('symbol', '3') |
|
1104 | 1104 | ('symbol', '4')) |
|
1105 | 1105 | ('symbol', '5') |
|
1106 | 1106 | ('symbol', '6')) |
|
1107 | 1107 | * optimized: |
|
1108 | 1108 | (or |
|
1109 | 1109 | (range |
|
1110 | 1110 | ('symbol', '0') |
|
1111 | 1111 | ('symbol', '1')) |
|
1112 | 1112 | ('symbol', '2') |
|
1113 | 1113 | (range |
|
1114 | 1114 | ('symbol', '3') |
|
1115 | 1115 | ('symbol', '4')) |
|
1116 | 1116 | (func |
|
1117 | 1117 | ('symbol', '_list') |
|
1118 | 1118 | ('string', '5\x006'))) |
|
1119 | 1119 | * set: |
|
1120 | 1120 | <addset |
|
1121 | 1121 | <addset |
|
1122 | 1122 | <spanset+ 0:1>, |
|
1123 | 1123 | <baseset [2]>>, |
|
1124 | 1124 | <addset |
|
1125 | 1125 | <spanset+ 3:4>, |
|
1126 | 1126 | <baseset [5, 6]>>> |
|
1127 | 1127 | 0 |
|
1128 | 1128 | 1 |
|
1129 | 1129 | 2 |
|
1130 | 1130 | 3 |
|
1131 | 1131 | 4 |
|
1132 | 1132 | 5 |
|
1133 | 1133 | 6 |
|
1134 | 1134 | |
|
1135 | 1135 | test that `_list` should be narrowed by provided `subset` |
|
1136 | 1136 | |
|
1137 | 1137 | $ log '0:2 and (null|1|2|3)' |
|
1138 | 1138 | 1 |
|
1139 | 1139 | 2 |
|
1140 | 1140 | |
|
1141 | 1141 | test that `_list` should remove duplicates |
|
1142 | 1142 | |
|
1143 | 1143 | $ log '0|1|2|1|2|-1|tip' |
|
1144 | 1144 | 0 |
|
1145 | 1145 | 1 |
|
1146 | 1146 | 2 |
|
1147 | 1147 | 9 |
|
1148 | 1148 | |
|
1149 | 1149 | test unknown revision in `_list` |
|
1150 | 1150 | |
|
1151 | 1151 | $ log '0|unknown' |
|
1152 | 1152 | abort: unknown revision 'unknown'! |
|
1153 | 1153 | [255] |
|
1154 | 1154 | |
|
1155 | 1155 | test integer range in `_list` |
|
1156 | 1156 | |
|
1157 | 1157 | $ log '-1|-10' |
|
1158 | 1158 | 9 |
|
1159 | 1159 | 0 |
|
1160 | 1160 | |
|
1161 | 1161 | $ log '-10|-11' |
|
1162 | 1162 | abort: unknown revision '-11'! |
|
1163 | 1163 | [255] |
|
1164 | 1164 | |
|
1165 | 1165 | $ log '9|10' |
|
1166 | 1166 | abort: unknown revision '10'! |
|
1167 | 1167 | [255] |
|
1168 | 1168 | |
|
1169 | 1169 | test '0000' != '0' in `_list` |
|
1170 | 1170 | |
|
1171 | 1171 | $ log '0|0000' |
|
1172 | 1172 | 0 |
|
1173 | 1173 | -1 |
|
1174 | 1174 | |
|
1175 | 1175 | test ',' in `_list` |
|
1176 | 1176 | $ log '0,1' |
|
1177 | 1177 | hg: parse error: can't use a list in this context |
|
1178 | 1178 | (see hg help "revsets.x or y") |
|
1179 | 1179 | [255] |
|
1180 | 1180 | $ try '0,1,2' |
|
1181 | 1181 | (list |
|
1182 | 1182 | ('symbol', '0') |
|
1183 | 1183 | ('symbol', '1') |
|
1184 | 1184 | ('symbol', '2')) |
|
1185 | 1185 | hg: parse error: can't use a list in this context |
|
1186 | 1186 | (see hg help "revsets.x or y") |
|
1187 | 1187 | [255] |
|
1188 | 1188 | |
|
1189 | 1189 | test that chained `or` operations make balanced addsets |
|
1190 | 1190 | |
|
1191 | 1191 | $ try '0:1|1:2|2:3|3:4|4:5' |
|
1192 | 1192 | (or |
|
1193 | 1193 | (range |
|
1194 | 1194 | ('symbol', '0') |
|
1195 | 1195 | ('symbol', '1')) |
|
1196 | 1196 | (range |
|
1197 | 1197 | ('symbol', '1') |
|
1198 | 1198 | ('symbol', '2')) |
|
1199 | 1199 | (range |
|
1200 | 1200 | ('symbol', '2') |
|
1201 | 1201 | ('symbol', '3')) |
|
1202 | 1202 | (range |
|
1203 | 1203 | ('symbol', '3') |
|
1204 | 1204 | ('symbol', '4')) |
|
1205 | 1205 | (range |
|
1206 | 1206 | ('symbol', '4') |
|
1207 | 1207 | ('symbol', '5'))) |
|
1208 | 1208 | * set: |
|
1209 | 1209 | <addset |
|
1210 | 1210 | <addset |
|
1211 | 1211 | <spanset+ 0:1>, |
|
1212 | 1212 | <spanset+ 1:2>>, |
|
1213 | 1213 | <addset |
|
1214 | 1214 | <spanset+ 2:3>, |
|
1215 | 1215 | <addset |
|
1216 | 1216 | <spanset+ 3:4>, |
|
1217 | 1217 | <spanset+ 4:5>>>> |
|
1218 | 1218 | 0 |
|
1219 | 1219 | 1 |
|
1220 | 1220 | 2 |
|
1221 | 1221 | 3 |
|
1222 | 1222 | 4 |
|
1223 | 1223 | 5 |
|
1224 | 1224 | |
|
1225 | 1225 | no crash by empty group "()" while optimizing `or` operations |
|
1226 | 1226 | |
|
1227 | 1227 | $ try --optimize '0|()' |
|
1228 | 1228 | (or |
|
1229 | 1229 | ('symbol', '0') |
|
1230 | 1230 | (group |
|
1231 | 1231 | None)) |
|
1232 | 1232 | * optimized: |
|
1233 | 1233 | (or |
|
1234 | 1234 | ('symbol', '0') |
|
1235 | 1235 | None) |
|
1236 | 1236 | hg: parse error: missing argument |
|
1237 | 1237 | [255] |
|
1238 | 1238 | |
|
1239 | 1239 | test that chained `or` operations never eat up stack (issue4624) |
|
1240 | 1240 | (uses `0:1` instead of `0` to avoid future optimization of trivial revisions) |
|
1241 | 1241 | |
|
1242 | 1242 | $ hg log -T '{rev}\n' -r `python -c "print '+'.join(['0:1'] * 500)"` |
|
1243 | 1243 | 0 |
|
1244 | 1244 | 1 |
|
1245 | 1245 | |
|
1246 | 1246 | test that repeated `-r` options never eat up stack (issue4565) |
|
1247 | 1247 | (uses `-r 0::1` to avoid possible optimization at old-style parser) |
|
1248 | 1248 | |
|
1249 | 1249 | $ hg log -T '{rev}\n' `python -c "for i in xrange(500): print '-r 0::1 ',"` |
|
1250 | 1250 | 0 |
|
1251 | 1251 | 1 |
|
1252 | 1252 | |
|
1253 | 1253 | check that conversion to only works |
|
1254 | 1254 | $ try --optimize '::3 - ::1' |
|
1255 | 1255 | (minus |
|
1256 | 1256 | (dagrangepre |
|
1257 | 1257 | ('symbol', '3')) |
|
1258 | 1258 | (dagrangepre |
|
1259 | 1259 | ('symbol', '1'))) |
|
1260 | 1260 | * optimized: |
|
1261 | 1261 | (func |
|
1262 | 1262 | ('symbol', 'only') |
|
1263 | 1263 | (list |
|
1264 | 1264 | ('symbol', '3') |
|
1265 | 1265 | ('symbol', '1'))) |
|
1266 | 1266 | * set: |
|
1267 | 1267 | <baseset+ [3]> |
|
1268 | 1268 | 3 |
|
1269 | 1269 | $ try --optimize 'ancestors(1) - ancestors(3)' |
|
1270 | 1270 | (minus |
|
1271 | 1271 | (func |
|
1272 | 1272 | ('symbol', 'ancestors') |
|
1273 | 1273 | ('symbol', '1')) |
|
1274 | 1274 | (func |
|
1275 | 1275 | ('symbol', 'ancestors') |
|
1276 | 1276 | ('symbol', '3'))) |
|
1277 | 1277 | * optimized: |
|
1278 | 1278 | (func |
|
1279 | 1279 | ('symbol', 'only') |
|
1280 | 1280 | (list |
|
1281 | 1281 | ('symbol', '1') |
|
1282 | 1282 | ('symbol', '3'))) |
|
1283 | 1283 | * set: |
|
1284 | 1284 | <baseset+ []> |
|
1285 | 1285 | $ try --optimize 'not ::2 and ::6' |
|
1286 | 1286 | (and |
|
1287 | 1287 | (not |
|
1288 | 1288 | (dagrangepre |
|
1289 | 1289 | ('symbol', '2'))) |
|
1290 | 1290 | (dagrangepre |
|
1291 | 1291 | ('symbol', '6'))) |
|
1292 | 1292 | * optimized: |
|
1293 | 1293 | (func |
|
1294 | 1294 | ('symbol', 'only') |
|
1295 | 1295 | (list |
|
1296 | 1296 | ('symbol', '6') |
|
1297 | 1297 | ('symbol', '2'))) |
|
1298 | 1298 | * set: |
|
1299 | 1299 | <baseset+ [3, 4, 5, 6]> |
|
1300 | 1300 | 3 |
|
1301 | 1301 | 4 |
|
1302 | 1302 | 5 |
|
1303 | 1303 | 6 |
|
1304 | 1304 | $ try --optimize 'ancestors(6) and not ancestors(4)' |
|
1305 | 1305 | (and |
|
1306 | 1306 | (func |
|
1307 | 1307 | ('symbol', 'ancestors') |
|
1308 | 1308 | ('symbol', '6')) |
|
1309 | 1309 | (not |
|
1310 | 1310 | (func |
|
1311 | 1311 | ('symbol', 'ancestors') |
|
1312 | 1312 | ('symbol', '4')))) |
|
1313 | 1313 | * optimized: |
|
1314 | 1314 | (func |
|
1315 | 1315 | ('symbol', 'only') |
|
1316 | 1316 | (list |
|
1317 | 1317 | ('symbol', '6') |
|
1318 | 1318 | ('symbol', '4'))) |
|
1319 | 1319 | * set: |
|
1320 | 1320 | <baseset+ [3, 5, 6]> |
|
1321 | 1321 | 3 |
|
1322 | 1322 | 5 |
|
1323 | 1323 | 6 |
|
1324 | 1324 | |
|
1325 | 1325 | no crash by empty group "()" while optimizing to "only()" |
|
1326 | 1326 | |
|
1327 | 1327 | $ try --optimize '::1 and ()' |
|
1328 | 1328 | (and |
|
1329 | 1329 | (dagrangepre |
|
1330 | 1330 | ('symbol', '1')) |
|
1331 | 1331 | (group |
|
1332 | 1332 | None)) |
|
1333 | 1333 | * optimized: |
|
1334 | 1334 | (and |
|
1335 | 1335 | None |
|
1336 | 1336 | (func |
|
1337 | 1337 | ('symbol', 'ancestors') |
|
1338 | 1338 | ('symbol', '1'))) |
|
1339 | 1339 | hg: parse error: missing argument |
|
1340 | 1340 | [255] |
|
1341 | 1341 | |
|
1342 | 1342 | we can use patterns when searching for tags |
|
1343 | 1343 | |
|
1344 | 1344 | $ log 'tag("1..*")' |
|
1345 | 1345 | abort: tag '1..*' does not exist! |
|
1346 | 1346 | [255] |
|
1347 | 1347 | $ log 'tag("re:1..*")' |
|
1348 | 1348 | 6 |
|
1349 | 1349 | $ log 'tag("re:[0-9].[0-9]")' |
|
1350 | 1350 | 6 |
|
1351 | 1351 | $ log 'tag("literal:1.0")' |
|
1352 | 1352 | 6 |
|
1353 | 1353 | $ log 'tag("re:0..*")' |
|
1354 | 1354 | |
|
1355 | 1355 | $ log 'tag(unknown)' |
|
1356 | 1356 | abort: tag 'unknown' does not exist! |
|
1357 | 1357 | [255] |
|
1358 | 1358 | $ log 'tag("re:unknown")' |
|
1359 | 1359 | $ log 'present(tag("unknown"))' |
|
1360 | 1360 | $ log 'present(tag("re:unknown"))' |
|
1361 | 1361 | $ log 'branch(unknown)' |
|
1362 | 1362 | abort: unknown revision 'unknown'! |
|
1363 | 1363 | [255] |
|
1364 | 1364 | $ log 'branch("literal:unknown")' |
|
1365 | 1365 | abort: branch 'unknown' does not exist! |
|
1366 | 1366 | [255] |
|
1367 | 1367 | $ log 'branch("re:unknown")' |
|
1368 | 1368 | $ log 'present(branch("unknown"))' |
|
1369 | 1369 | $ log 'present(branch("re:unknown"))' |
|
1370 | 1370 | $ log 'user(bob)' |
|
1371 | 1371 | 2 |
|
1372 | 1372 | |
|
1373 | 1373 | $ log '4::8' |
|
1374 | 1374 | 4 |
|
1375 | 1375 | 8 |
|
1376 | 1376 | $ log '4:8' |
|
1377 | 1377 | 4 |
|
1378 | 1378 | 5 |
|
1379 | 1379 | 6 |
|
1380 | 1380 | 7 |
|
1381 | 1381 | 8 |
|
1382 | 1382 | |
|
1383 | 1383 | $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' |
|
1384 | 1384 | 4 |
|
1385 | 1385 | 2 |
|
1386 | 1386 | 5 |
|
1387 | 1387 | |
|
1388 | 1388 | $ log 'not 0 and 0:2' |
|
1389 | 1389 | 1 |
|
1390 | 1390 | 2 |
|
1391 | 1391 | $ log 'not 1 and 0:2' |
|
1392 | 1392 | 0 |
|
1393 | 1393 | 2 |
|
1394 | 1394 | $ log 'not 2 and 0:2' |
|
1395 | 1395 | 0 |
|
1396 | 1396 | 1 |
|
1397 | 1397 | $ log '(1 and 2)::' |
|
1398 | 1398 | $ log '(1 and 2):' |
|
1399 | 1399 | $ log '(1 and 2):3' |
|
1400 | 1400 | $ log 'sort(head(), -rev)' |
|
1401 | 1401 | 9 |
|
1402 | 1402 | 7 |
|
1403 | 1403 | 6 |
|
1404 | 1404 | 5 |
|
1405 | 1405 | 4 |
|
1406 | 1406 | 3 |
|
1407 | 1407 | 2 |
|
1408 | 1408 | 1 |
|
1409 | 1409 | 0 |
|
1410 | 1410 | $ log '4::8 - 8' |
|
1411 | 1411 | 4 |
|
1412 | 1412 | $ log 'matching(1 or 2 or 3) and (2 or 3 or 1)' |
|
1413 | 1413 | 2 |
|
1414 | 1414 | 3 |
|
1415 | 1415 | 1 |
|
1416 | 1416 | |
|
1417 | 1417 | $ log 'named("unknown")' |
|
1418 | 1418 | abort: namespace 'unknown' does not exist! |
|
1419 | 1419 | [255] |
|
1420 | 1420 | $ log 'named("re:unknown")' |
|
1421 | 1421 | abort: no namespace exists that match 'unknown'! |
|
1422 | 1422 | [255] |
|
1423 | 1423 | $ log 'present(named("unknown"))' |
|
1424 | 1424 | $ log 'present(named("re:unknown"))' |
|
1425 | 1425 | |
|
1426 | 1426 | $ log 'tag()' |
|
1427 | 1427 | 6 |
|
1428 | 1428 | $ log 'named("tags")' |
|
1429 | 1429 | 6 |
|
1430 | 1430 | |
|
1431 | 1431 | issue2437 |
|
1432 | 1432 | |
|
1433 | 1433 | $ log '3 and p1(5)' |
|
1434 | 1434 | 3 |
|
1435 | 1435 | $ log '4 and p2(6)' |
|
1436 | 1436 | 4 |
|
1437 | 1437 | $ log '1 and parents(:2)' |
|
1438 | 1438 | 1 |
|
1439 | 1439 | $ log '2 and children(1:)' |
|
1440 | 1440 | 2 |
|
1441 | 1441 | $ log 'roots(all()) or roots(all())' |
|
1442 | 1442 | 0 |
|
1443 | 1443 | $ hg debugrevspec 'roots(all()) or roots(all())' |
|
1444 | 1444 | 0 |
|
1445 | 1445 | $ log 'heads(branch(Γ©)) or heads(branch(Γ©))' |
|
1446 | 1446 | 9 |
|
1447 | 1447 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))' |
|
1448 | 1448 | 4 |
|
1449 | 1449 | |
|
1450 | 1450 | issue2654: report a parse error if the revset was not completely parsed |
|
1451 | 1451 | |
|
1452 | 1452 | $ log '1 OR 2' |
|
1453 | 1453 | hg: parse error at 2: invalid token |
|
1454 | 1454 | [255] |
|
1455 | 1455 | |
|
1456 | 1456 | or operator should preserve ordering: |
|
1457 | 1457 | $ log 'reverse(2::4) or tip' |
|
1458 | 1458 | 4 |
|
1459 | 1459 | 2 |
|
1460 | 1460 | 9 |
|
1461 | 1461 | |
|
1462 | 1462 | parentrevspec |
|
1463 | 1463 | |
|
1464 | 1464 | $ log 'merge()^0' |
|
1465 | 1465 | 6 |
|
1466 | 1466 | $ log 'merge()^' |
|
1467 | 1467 | 5 |
|
1468 | 1468 | $ log 'merge()^1' |
|
1469 | 1469 | 5 |
|
1470 | 1470 | $ log 'merge()^2' |
|
1471 | 1471 | 4 |
|
1472 | 1472 | $ log 'merge()^^' |
|
1473 | 1473 | 3 |
|
1474 | 1474 | $ log 'merge()^1^' |
|
1475 | 1475 | 3 |
|
1476 | 1476 | $ log 'merge()^^^' |
|
1477 | 1477 | 1 |
|
1478 | 1478 | |
|
1479 | 1479 | $ log 'merge()~0' |
|
1480 | 1480 | 6 |
|
1481 | 1481 | $ log 'merge()~1' |
|
1482 | 1482 | 5 |
|
1483 | 1483 | $ log 'merge()~2' |
|
1484 | 1484 | 3 |
|
1485 | 1485 | $ log 'merge()~2^1' |
|
1486 | 1486 | 1 |
|
1487 | 1487 | $ log 'merge()~3' |
|
1488 | 1488 | 1 |
|
1489 | 1489 | |
|
1490 | 1490 | $ log '(-3:tip)^' |
|
1491 | 1491 | 4 |
|
1492 | 1492 | 6 |
|
1493 | 1493 | 8 |
|
1494 | 1494 | |
|
1495 | 1495 | $ log 'tip^foo' |
|
1496 | 1496 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
1497 | 1497 | [255] |
|
1498 | 1498 | |
|
1499 | 1499 | Bogus function gets suggestions |
|
1500 | 1500 | $ log 'add()' |
|
1501 | 1501 | hg: parse error: unknown identifier: add |
|
1502 | 1502 | (did you mean adds?) |
|
1503 | 1503 | [255] |
|
1504 | 1504 | $ log 'added()' |
|
1505 | 1505 | hg: parse error: unknown identifier: added |
|
1506 | 1506 | (did you mean adds?) |
|
1507 | 1507 | [255] |
|
1508 | 1508 | $ log 'remo()' |
|
1509 | 1509 | hg: parse error: unknown identifier: remo |
|
1510 | 1510 | (did you mean one of remote, removes?) |
|
1511 | 1511 | [255] |
|
1512 | 1512 | $ log 'babar()' |
|
1513 | 1513 | hg: parse error: unknown identifier: babar |
|
1514 | 1514 | [255] |
|
1515 | 1515 | |
|
1516 | 1516 | Bogus function with a similar internal name doesn't suggest the internal name |
|
1517 | 1517 | $ log 'matches()' |
|
1518 | 1518 | hg: parse error: unknown identifier: matches |
|
1519 | 1519 | (did you mean matching?) |
|
1520 | 1520 | [255] |
|
1521 | 1521 | |
|
1522 | 1522 | Undocumented functions aren't suggested as similar either |
|
1523 | 1523 | $ log 'wdir2()' |
|
1524 | 1524 | hg: parse error: unknown identifier: wdir2 |
|
1525 | 1525 | [255] |
|
1526 | 1526 | |
|
1527 | 1527 | multiple revspecs |
|
1528 | 1528 | |
|
1529 | 1529 | $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' |
|
1530 | 1530 | 8 |
|
1531 | 1531 | 9 |
|
1532 | 1532 | 4 |
|
1533 | 1533 | 5 |
|
1534 | 1534 | 6 |
|
1535 | 1535 | 7 |
|
1536 | 1536 | |
|
1537 | 1537 | test usage in revpair (with "+") |
|
1538 | 1538 | |
|
1539 | 1539 | (real pair) |
|
1540 | 1540 | |
|
1541 | 1541 | $ hg diff -r 'tip^^' -r 'tip' |
|
1542 | 1542 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
1543 | 1543 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1544 | 1544 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
1545 | 1545 | @@ -0,0 +1,1 @@ |
|
1546 | 1546 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
1547 | 1547 | $ hg diff -r 'tip^^::tip' |
|
1548 | 1548 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
1549 | 1549 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1550 | 1550 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
1551 | 1551 | @@ -0,0 +1,1 @@ |
|
1552 | 1552 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
1553 | 1553 | |
|
1554 | 1554 | (single rev) |
|
1555 | 1555 | |
|
1556 | 1556 | $ hg diff -r 'tip^' -r 'tip^' |
|
1557 | 1557 | $ hg diff -r 'tip^:tip^' |
|
1558 | 1558 | |
|
1559 | 1559 | (single rev that does not looks like a range) |
|
1560 | 1560 | |
|
1561 | 1561 | $ hg diff -r 'tip^::tip^ or tip^' |
|
1562 | 1562 | diff -r d5d0dcbdc4d9 .hgtags |
|
1563 | 1563 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1564 | 1564 | +++ b/.hgtags * (glob) |
|
1565 | 1565 | @@ -0,0 +1,1 @@ |
|
1566 | 1566 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
1567 | 1567 | $ hg diff -r 'tip^ or tip^' |
|
1568 | 1568 | diff -r d5d0dcbdc4d9 .hgtags |
|
1569 | 1569 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1570 | 1570 | +++ b/.hgtags * (glob) |
|
1571 | 1571 | @@ -0,0 +1,1 @@ |
|
1572 | 1572 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
1573 | 1573 | |
|
1574 | 1574 | (no rev) |
|
1575 | 1575 | |
|
1576 | 1576 | $ hg diff -r 'author("babar") or author("celeste")' |
|
1577 | 1577 | abort: empty revision range |
|
1578 | 1578 | [255] |
|
1579 | 1579 | |
|
1580 | 1580 | aliases: |
|
1581 | 1581 | |
|
1582 | 1582 | $ echo '[revsetalias]' >> .hg/hgrc |
|
1583 | 1583 | $ echo 'm = merge()' >> .hg/hgrc |
|
1584 | 1584 | (revset aliases can override builtin revsets) |
|
1585 | 1585 | $ echo 'p2($1) = p1($1)' >> .hg/hgrc |
|
1586 | 1586 | $ echo 'sincem = descendants(m)' >> .hg/hgrc |
|
1587 | 1587 | $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc |
|
1588 | 1588 | $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
1589 | 1589 | $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
1590 | 1590 | |
|
1591 | 1591 | $ try m |
|
1592 | 1592 | ('symbol', 'm') |
|
1593 | 1593 | * expanded: |
|
1594 | 1594 | (func |
|
1595 | 1595 | ('symbol', 'merge') |
|
1596 | 1596 | None) |
|
1597 | 1597 | * set: |
|
1598 | 1598 | <filteredset |
|
1599 | 1599 | <fullreposet+ 0:9>, |
|
1600 | 1600 | <merge>> |
|
1601 | 1601 | 6 |
|
1602 | 1602 | |
|
1603 | 1603 | $ HGPLAIN=1 |
|
1604 | 1604 | $ export HGPLAIN |
|
1605 | 1605 | $ try m |
|
1606 | 1606 | ('symbol', 'm') |
|
1607 | 1607 | abort: unknown revision 'm'! |
|
1608 | 1608 | [255] |
|
1609 | 1609 | |
|
1610 | 1610 | $ HGPLAINEXCEPT=revsetalias |
|
1611 | 1611 | $ export HGPLAINEXCEPT |
|
1612 | 1612 | $ try m |
|
1613 | 1613 | ('symbol', 'm') |
|
1614 | 1614 | * expanded: |
|
1615 | 1615 | (func |
|
1616 | 1616 | ('symbol', 'merge') |
|
1617 | 1617 | None) |
|
1618 | 1618 | * set: |
|
1619 | 1619 | <filteredset |
|
1620 | 1620 | <fullreposet+ 0:9>, |
|
1621 | 1621 | <merge>> |
|
1622 | 1622 | 6 |
|
1623 | 1623 | |
|
1624 | 1624 | $ unset HGPLAIN |
|
1625 | 1625 | $ unset HGPLAINEXCEPT |
|
1626 | 1626 | |
|
1627 | 1627 | $ try 'p2(.)' |
|
1628 | 1628 | (func |
|
1629 | 1629 | ('symbol', 'p2') |
|
1630 | 1630 | ('symbol', '.')) |
|
1631 | 1631 | * expanded: |
|
1632 | 1632 | (func |
|
1633 | 1633 | ('symbol', 'p1') |
|
1634 | 1634 | ('symbol', '.')) |
|
1635 | 1635 | * set: |
|
1636 | 1636 | <baseset+ [8]> |
|
1637 | 1637 | 8 |
|
1638 | 1638 | |
|
1639 | 1639 | $ HGPLAIN=1 |
|
1640 | 1640 | $ export HGPLAIN |
|
1641 | 1641 | $ try 'p2(.)' |
|
1642 | 1642 | (func |
|
1643 | 1643 | ('symbol', 'p2') |
|
1644 | 1644 | ('symbol', '.')) |
|
1645 | 1645 | * set: |
|
1646 | 1646 | <baseset+ []> |
|
1647 | 1647 | |
|
1648 | 1648 | $ HGPLAINEXCEPT=revsetalias |
|
1649 | 1649 | $ export HGPLAINEXCEPT |
|
1650 | 1650 | $ try 'p2(.)' |
|
1651 | 1651 | (func |
|
1652 | 1652 | ('symbol', 'p2') |
|
1653 | 1653 | ('symbol', '.')) |
|
1654 | 1654 | * expanded: |
|
1655 | 1655 | (func |
|
1656 | 1656 | ('symbol', 'p1') |
|
1657 | 1657 | ('symbol', '.')) |
|
1658 | 1658 | * set: |
|
1659 | 1659 | <baseset+ [8]> |
|
1660 | 1660 | 8 |
|
1661 | 1661 | |
|
1662 | 1662 | $ unset HGPLAIN |
|
1663 | 1663 | $ unset HGPLAINEXCEPT |
|
1664 | 1664 | |
|
1665 | 1665 | test alias recursion |
|
1666 | 1666 | |
|
1667 | 1667 | $ try sincem |
|
1668 | 1668 | ('symbol', 'sincem') |
|
1669 | 1669 | * expanded: |
|
1670 | 1670 | (func |
|
1671 | 1671 | ('symbol', 'descendants') |
|
1672 | 1672 | (func |
|
1673 | 1673 | ('symbol', 'merge') |
|
1674 | 1674 | None)) |
|
1675 | 1675 | * set: |
|
1676 | 1676 | <addset+ |
|
1677 | 1677 | <filteredset |
|
1678 | 1678 | <fullreposet+ 0:9>, |
|
1679 | 1679 | <merge>>, |
|
1680 | 1680 | <generatorset+>> |
|
1681 | 1681 | 6 |
|
1682 | 1682 | 7 |
|
1683 | 1683 | |
|
1684 | 1684 | test infinite recursion |
|
1685 | 1685 | |
|
1686 | 1686 | $ echo 'recurse1 = recurse2' >> .hg/hgrc |
|
1687 | 1687 | $ echo 'recurse2 = recurse1' >> .hg/hgrc |
|
1688 | 1688 | $ try recurse1 |
|
1689 | 1689 | ('symbol', 'recurse1') |
|
1690 | 1690 | hg: parse error: infinite expansion of revset alias "recurse1" detected |
|
1691 | 1691 | [255] |
|
1692 | 1692 | |
|
1693 | 1693 | $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc |
|
1694 | 1694 | $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc |
|
1695 | 1695 | $ try "level2(level1(1, 2), 3)" |
|
1696 | 1696 | (func |
|
1697 | 1697 | ('symbol', 'level2') |
|
1698 | 1698 | (list |
|
1699 | 1699 | (func |
|
1700 | 1700 | ('symbol', 'level1') |
|
1701 | 1701 | (list |
|
1702 | 1702 | ('symbol', '1') |
|
1703 | 1703 | ('symbol', '2'))) |
|
1704 | 1704 | ('symbol', '3'))) |
|
1705 | 1705 | * expanded: |
|
1706 | 1706 | (or |
|
1707 | 1707 | ('symbol', '3') |
|
1708 | 1708 | (or |
|
1709 | 1709 | ('symbol', '1') |
|
1710 | 1710 | ('symbol', '2'))) |
|
1711 | 1711 | * set: |
|
1712 | 1712 | <addset |
|
1713 | 1713 | <baseset [3]>, |
|
1714 | 1714 | <baseset [1, 2]>> |
|
1715 | 1715 | 3 |
|
1716 | 1716 | 1 |
|
1717 | 1717 | 2 |
|
1718 | 1718 | |
|
1719 | 1719 | test nesting and variable passing |
|
1720 | 1720 | |
|
1721 | 1721 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc |
|
1722 | 1722 | $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc |
|
1723 | 1723 | $ echo 'nested3($1) = max($1)' >> .hg/hgrc |
|
1724 | 1724 | $ try 'nested(2:5)' |
|
1725 | 1725 | (func |
|
1726 | 1726 | ('symbol', 'nested') |
|
1727 | 1727 | (range |
|
1728 | 1728 | ('symbol', '2') |
|
1729 | 1729 | ('symbol', '5'))) |
|
1730 | 1730 | * expanded: |
|
1731 | 1731 | (func |
|
1732 | 1732 | ('symbol', 'max') |
|
1733 | 1733 | (range |
|
1734 | 1734 | ('symbol', '2') |
|
1735 | 1735 | ('symbol', '5'))) |
|
1736 | 1736 | * set: |
|
1737 | 1737 | <baseset |
|
1738 | 1738 | <max |
|
1739 | 1739 | <fullreposet+ 0:9>, |
|
1740 | 1740 | <spanset+ 2:5>>> |
|
1741 | 1741 | 5 |
|
1742 | 1742 | |
|
1743 | 1743 | test chained `or` operations are flattened at parsing phase |
|
1744 | 1744 | |
|
1745 | 1745 | $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc |
|
1746 | 1746 | $ try 'chainedorops(0:1, 1:2, 2:3)' |
|
1747 | 1747 | (func |
|
1748 | 1748 | ('symbol', 'chainedorops') |
|
1749 | 1749 | (list |
|
1750 | 1750 | (range |
|
1751 | 1751 | ('symbol', '0') |
|
1752 | 1752 | ('symbol', '1')) |
|
1753 | 1753 | (range |
|
1754 | 1754 | ('symbol', '1') |
|
1755 | 1755 | ('symbol', '2')) |
|
1756 | 1756 | (range |
|
1757 | 1757 | ('symbol', '2') |
|
1758 | 1758 | ('symbol', '3')))) |
|
1759 | 1759 | * expanded: |
|
1760 | 1760 | (or |
|
1761 | 1761 | (range |
|
1762 | 1762 | ('symbol', '0') |
|
1763 | 1763 | ('symbol', '1')) |
|
1764 | 1764 | (range |
|
1765 | 1765 | ('symbol', '1') |
|
1766 | 1766 | ('symbol', '2')) |
|
1767 | 1767 | (range |
|
1768 | 1768 | ('symbol', '2') |
|
1769 | 1769 | ('symbol', '3'))) |
|
1770 | 1770 | * set: |
|
1771 | 1771 | <addset |
|
1772 | 1772 | <spanset+ 0:1>, |
|
1773 | 1773 | <addset |
|
1774 | 1774 | <spanset+ 1:2>, |
|
1775 | 1775 | <spanset+ 2:3>>> |
|
1776 | 1776 | 0 |
|
1777 | 1777 | 1 |
|
1778 | 1778 | 2 |
|
1779 | 1779 | 3 |
|
1780 | 1780 | |
|
1781 | 1781 | test variable isolation, variable placeholders are rewritten as string |
|
1782 | 1782 | then parsed and matched again as string. Check they do not leak too |
|
1783 | 1783 | far away. |
|
1784 | 1784 | |
|
1785 | 1785 | $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc |
|
1786 | 1786 | $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc |
|
1787 | 1787 | $ try 'callinjection(2:5)' |
|
1788 | 1788 | (func |
|
1789 | 1789 | ('symbol', 'callinjection') |
|
1790 | 1790 | (range |
|
1791 | 1791 | ('symbol', '2') |
|
1792 | 1792 | ('symbol', '5'))) |
|
1793 | 1793 | * expanded: |
|
1794 | 1794 | (func |
|
1795 | 1795 | ('symbol', 'descendants') |
|
1796 | 1796 | (func |
|
1797 | 1797 | ('symbol', 'max') |
|
1798 | 1798 | ('string', '$1'))) |
|
1799 | 1799 | abort: unknown revision '$1'! |
|
1800 | 1800 | [255] |
|
1801 | 1801 | |
|
1802 | test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)', | |
|
1803 | but 'all()' should never be substituded to '0()'. | |
|
1804 | ||
|
1805 | $ echo 'universe = all()' >> .hg/hgrc | |
|
1806 | $ echo 'shadowall(all) = all and universe' >> .hg/hgrc | |
|
1807 | $ try 'shadowall(0)' | |
|
1808 | (func | |
|
1809 | ('symbol', 'shadowall') | |
|
1810 | ('symbol', '0')) | |
|
1811 | * expanded: | |
|
1812 | (and | |
|
1813 | ('symbol', '0') | |
|
1814 | (func | |
|
1815 | ('symbol', 'all') | |
|
1816 | None)) | |
|
1817 | * set: | |
|
1818 | <filteredset | |
|
1819 | <baseset [0]>, | |
|
1820 | <spanset+ 0:9>> | |
|
1821 | 0 | |
|
1822 | ||
|
1802 | 1823 | $ echo 'injectparamasstring2 = max(_aliasarg("$1"))' >> .hg/hgrc |
|
1803 | 1824 | $ echo 'callinjection2($1) = descendants(injectparamasstring2)' >> .hg/hgrc |
|
1804 | 1825 | $ try 'callinjection2(2:5)' |
|
1805 | 1826 | (func |
|
1806 | 1827 | ('symbol', 'callinjection2') |
|
1807 | 1828 | (range |
|
1808 | 1829 | ('symbol', '2') |
|
1809 | 1830 | ('symbol', '5'))) |
|
1810 | 1831 | abort: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg |
|
1811 | 1832 | [255] |
|
1812 | 1833 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" |
|
1813 | 1834 | ('symbol', 'tip') |
|
1814 | 1835 | warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end |
|
1815 | 1836 | warning: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg |
|
1816 | 1837 | * set: |
|
1817 | 1838 | <baseset [9]> |
|
1818 | 1839 | 9 |
|
1819 | 1840 | >>> data = file('.hg/hgrc', 'rb').read() |
|
1820 | 1841 | >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', '')) |
|
1821 | 1842 | |
|
1822 | 1843 | $ try 'tip' |
|
1823 | 1844 | ('symbol', 'tip') |
|
1824 | 1845 | * set: |
|
1825 | 1846 | <baseset [9]> |
|
1826 | 1847 | 9 |
|
1827 | 1848 | |
|
1828 | 1849 | $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" |
|
1829 | 1850 | ('symbol', 'tip') |
|
1830 | 1851 | warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token |
|
1831 | 1852 | * set: |
|
1832 | 1853 | <baseset [9]> |
|
1833 | 1854 | 9 |
|
1834 | 1855 | $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc |
|
1835 | 1856 | $ try 'strictreplacing("foo", tip)' |
|
1836 | 1857 | (func |
|
1837 | 1858 | ('symbol', 'strictreplacing') |
|
1838 | 1859 | (list |
|
1839 | 1860 | ('string', 'foo') |
|
1840 | 1861 | ('symbol', 'tip'))) |
|
1841 | 1862 | * expanded: |
|
1842 | 1863 | (or |
|
1843 | 1864 | ('symbol', 'tip') |
|
1844 | 1865 | (func |
|
1845 | 1866 | ('symbol', 'desc') |
|
1846 | 1867 | ('string', '$1'))) |
|
1847 | 1868 | * set: |
|
1848 | 1869 | <addset |
|
1849 | 1870 | <baseset [9]>, |
|
1850 | 1871 | <filteredset |
|
1851 | 1872 | <fullreposet+ 0:9>, |
|
1852 | 1873 | <desc '$1'>>> |
|
1853 | 1874 | 9 |
|
1854 | 1875 | |
|
1855 | 1876 | $ try 'd(2:5)' |
|
1856 | 1877 | (func |
|
1857 | 1878 | ('symbol', 'd') |
|
1858 | 1879 | (range |
|
1859 | 1880 | ('symbol', '2') |
|
1860 | 1881 | ('symbol', '5'))) |
|
1861 | 1882 | * expanded: |
|
1862 | 1883 | (func |
|
1863 | 1884 | ('symbol', 'reverse') |
|
1864 | 1885 | (func |
|
1865 | 1886 | ('symbol', 'sort') |
|
1866 | 1887 | (list |
|
1867 | 1888 | (range |
|
1868 | 1889 | ('symbol', '2') |
|
1869 | 1890 | ('symbol', '5')) |
|
1870 | 1891 | ('symbol', 'date')))) |
|
1871 | 1892 | * set: |
|
1872 | 1893 | <baseset [4, 5, 3, 2]> |
|
1873 | 1894 | 4 |
|
1874 | 1895 | 5 |
|
1875 | 1896 | 3 |
|
1876 | 1897 | 2 |
|
1877 | 1898 | $ try 'rs(2 or 3, date)' |
|
1878 | 1899 | (func |
|
1879 | 1900 | ('symbol', 'rs') |
|
1880 | 1901 | (list |
|
1881 | 1902 | (or |
|
1882 | 1903 | ('symbol', '2') |
|
1883 | 1904 | ('symbol', '3')) |
|
1884 | 1905 | ('symbol', 'date'))) |
|
1885 | 1906 | * expanded: |
|
1886 | 1907 | (func |
|
1887 | 1908 | ('symbol', 'reverse') |
|
1888 | 1909 | (func |
|
1889 | 1910 | ('symbol', 'sort') |
|
1890 | 1911 | (list |
|
1891 | 1912 | (or |
|
1892 | 1913 | ('symbol', '2') |
|
1893 | 1914 | ('symbol', '3')) |
|
1894 | 1915 | ('symbol', 'date')))) |
|
1895 | 1916 | * set: |
|
1896 | 1917 | <baseset [3, 2]> |
|
1897 | 1918 | 3 |
|
1898 | 1919 | 2 |
|
1899 | 1920 | $ try 'rs()' |
|
1900 | 1921 | (func |
|
1901 | 1922 | ('symbol', 'rs') |
|
1902 | 1923 | None) |
|
1903 | 1924 | hg: parse error: invalid number of arguments: 0 |
|
1904 | 1925 | [255] |
|
1905 | 1926 | $ try 'rs(2)' |
|
1906 | 1927 | (func |
|
1907 | 1928 | ('symbol', 'rs') |
|
1908 | 1929 | ('symbol', '2')) |
|
1909 | 1930 | hg: parse error: invalid number of arguments: 1 |
|
1910 | 1931 | [255] |
|
1911 | 1932 | $ try 'rs(2, data, 7)' |
|
1912 | 1933 | (func |
|
1913 | 1934 | ('symbol', 'rs') |
|
1914 | 1935 | (list |
|
1915 | 1936 | ('symbol', '2') |
|
1916 | 1937 | ('symbol', 'data') |
|
1917 | 1938 | ('symbol', '7'))) |
|
1918 | 1939 | hg: parse error: invalid number of arguments: 3 |
|
1919 | 1940 | [255] |
|
1920 | 1941 | $ try 'rs4(2 or 3, x, x, date)' |
|
1921 | 1942 | (func |
|
1922 | 1943 | ('symbol', 'rs4') |
|
1923 | 1944 | (list |
|
1924 | 1945 | (or |
|
1925 | 1946 | ('symbol', '2') |
|
1926 | 1947 | ('symbol', '3')) |
|
1927 | 1948 | ('symbol', 'x') |
|
1928 | 1949 | ('symbol', 'x') |
|
1929 | 1950 | ('symbol', 'date'))) |
|
1930 | 1951 | * expanded: |
|
1931 | 1952 | (func |
|
1932 | 1953 | ('symbol', 'reverse') |
|
1933 | 1954 | (func |
|
1934 | 1955 | ('symbol', 'sort') |
|
1935 | 1956 | (list |
|
1936 | 1957 | (or |
|
1937 | 1958 | ('symbol', '2') |
|
1938 | 1959 | ('symbol', '3')) |
|
1939 | 1960 | ('symbol', 'date')))) |
|
1940 | 1961 | * set: |
|
1941 | 1962 | <baseset [3, 2]> |
|
1942 | 1963 | 3 |
|
1943 | 1964 | 2 |
|
1944 | 1965 | |
|
1945 | 1966 | issue4553: check that revset aliases override existing hash prefix |
|
1946 | 1967 | |
|
1947 | 1968 | $ hg log -qr e |
|
1948 | 1969 | 6:e0cc66ef77e8 |
|
1949 | 1970 | |
|
1950 | 1971 | $ hg log -qr e --config revsetalias.e="all()" |
|
1951 | 1972 | 0:2785f51eece5 |
|
1952 | 1973 | 1:d75937da8da0 |
|
1953 | 1974 | 2:5ed5505e9f1c |
|
1954 | 1975 | 3:8528aa5637f2 |
|
1955 | 1976 | 4:2326846efdab |
|
1956 | 1977 | 5:904fa392b941 |
|
1957 | 1978 | 6:e0cc66ef77e8 |
|
1958 | 1979 | 7:013af1973af4 |
|
1959 | 1980 | 8:d5d0dcbdc4d9 |
|
1960 | 1981 | 9:24286f4ae135 |
|
1961 | 1982 | |
|
1962 | 1983 | $ hg log -qr e: --config revsetalias.e="0" |
|
1963 | 1984 | 0:2785f51eece5 |
|
1964 | 1985 | 1:d75937da8da0 |
|
1965 | 1986 | 2:5ed5505e9f1c |
|
1966 | 1987 | 3:8528aa5637f2 |
|
1967 | 1988 | 4:2326846efdab |
|
1968 | 1989 | 5:904fa392b941 |
|
1969 | 1990 | 6:e0cc66ef77e8 |
|
1970 | 1991 | 7:013af1973af4 |
|
1971 | 1992 | 8:d5d0dcbdc4d9 |
|
1972 | 1993 | 9:24286f4ae135 |
|
1973 | 1994 | |
|
1974 | 1995 | $ hg log -qr :e --config revsetalias.e="9" |
|
1975 | 1996 | 0:2785f51eece5 |
|
1976 | 1997 | 1:d75937da8da0 |
|
1977 | 1998 | 2:5ed5505e9f1c |
|
1978 | 1999 | 3:8528aa5637f2 |
|
1979 | 2000 | 4:2326846efdab |
|
1980 | 2001 | 5:904fa392b941 |
|
1981 | 2002 | 6:e0cc66ef77e8 |
|
1982 | 2003 | 7:013af1973af4 |
|
1983 | 2004 | 8:d5d0dcbdc4d9 |
|
1984 | 2005 | 9:24286f4ae135 |
|
1985 | 2006 | |
|
1986 | 2007 | $ hg log -qr e: |
|
1987 | 2008 | 6:e0cc66ef77e8 |
|
1988 | 2009 | 7:013af1973af4 |
|
1989 | 2010 | 8:d5d0dcbdc4d9 |
|
1990 | 2011 | 9:24286f4ae135 |
|
1991 | 2012 | |
|
1992 | 2013 | $ hg log -qr :e |
|
1993 | 2014 | 0:2785f51eece5 |
|
1994 | 2015 | 1:d75937da8da0 |
|
1995 | 2016 | 2:5ed5505e9f1c |
|
1996 | 2017 | 3:8528aa5637f2 |
|
1997 | 2018 | 4:2326846efdab |
|
1998 | 2019 | 5:904fa392b941 |
|
1999 | 2020 | 6:e0cc66ef77e8 |
|
2000 | 2021 | |
|
2001 | 2022 | issue2549 - correct optimizations |
|
2002 | 2023 | |
|
2003 | 2024 | $ try 'limit(1 or 2 or 3, 2) and not 2' |
|
2004 | 2025 | (and |
|
2005 | 2026 | (func |
|
2006 | 2027 | ('symbol', 'limit') |
|
2007 | 2028 | (list |
|
2008 | 2029 | (or |
|
2009 | 2030 | ('symbol', '1') |
|
2010 | 2031 | ('symbol', '2') |
|
2011 | 2032 | ('symbol', '3')) |
|
2012 | 2033 | ('symbol', '2'))) |
|
2013 | 2034 | (not |
|
2014 | 2035 | ('symbol', '2'))) |
|
2015 | 2036 | * set: |
|
2016 | 2037 | <filteredset |
|
2017 | 2038 | <baseset |
|
2018 | 2039 | <limit n=2, offset=0, |
|
2019 | 2040 | <fullreposet+ 0:9>, |
|
2020 | 2041 | <baseset [1, 2, 3]>>>, |
|
2021 | 2042 | <not |
|
2022 | 2043 | <baseset [2]>>> |
|
2023 | 2044 | 1 |
|
2024 | 2045 | $ try 'max(1 or 2) and not 2' |
|
2025 | 2046 | (and |
|
2026 | 2047 | (func |
|
2027 | 2048 | ('symbol', 'max') |
|
2028 | 2049 | (or |
|
2029 | 2050 | ('symbol', '1') |
|
2030 | 2051 | ('symbol', '2'))) |
|
2031 | 2052 | (not |
|
2032 | 2053 | ('symbol', '2'))) |
|
2033 | 2054 | * set: |
|
2034 | 2055 | <filteredset |
|
2035 | 2056 | <baseset |
|
2036 | 2057 | <max |
|
2037 | 2058 | <fullreposet+ 0:9>, |
|
2038 | 2059 | <baseset [1, 2]>>>, |
|
2039 | 2060 | <not |
|
2040 | 2061 | <baseset [2]>>> |
|
2041 | 2062 | $ try 'min(1 or 2) and not 1' |
|
2042 | 2063 | (and |
|
2043 | 2064 | (func |
|
2044 | 2065 | ('symbol', 'min') |
|
2045 | 2066 | (or |
|
2046 | 2067 | ('symbol', '1') |
|
2047 | 2068 | ('symbol', '2'))) |
|
2048 | 2069 | (not |
|
2049 | 2070 | ('symbol', '1'))) |
|
2050 | 2071 | * set: |
|
2051 | 2072 | <filteredset |
|
2052 | 2073 | <baseset |
|
2053 | 2074 | <min |
|
2054 | 2075 | <fullreposet+ 0:9>, |
|
2055 | 2076 | <baseset [1, 2]>>>, |
|
2056 | 2077 | <not |
|
2057 | 2078 | <baseset [1]>>> |
|
2058 | 2079 | $ try 'last(1 or 2, 1) and not 2' |
|
2059 | 2080 | (and |
|
2060 | 2081 | (func |
|
2061 | 2082 | ('symbol', 'last') |
|
2062 | 2083 | (list |
|
2063 | 2084 | (or |
|
2064 | 2085 | ('symbol', '1') |
|
2065 | 2086 | ('symbol', '2')) |
|
2066 | 2087 | ('symbol', '1'))) |
|
2067 | 2088 | (not |
|
2068 | 2089 | ('symbol', '2'))) |
|
2069 | 2090 | * set: |
|
2070 | 2091 | <filteredset |
|
2071 | 2092 | <baseset |
|
2072 | 2093 | <last n=1, |
|
2073 | 2094 | <fullreposet+ 0:9>, |
|
2074 | 2095 | <baseset [2, 1]>>>, |
|
2075 | 2096 | <not |
|
2076 | 2097 | <baseset [2]>>> |
|
2077 | 2098 | |
|
2078 | 2099 | issue4289 - ordering of built-ins |
|
2079 | 2100 | $ hg log -M -q -r 3:2 |
|
2080 | 2101 | 3:8528aa5637f2 |
|
2081 | 2102 | 2:5ed5505e9f1c |
|
2082 | 2103 | |
|
2083 | 2104 | test revsets started with 40-chars hash (issue3669) |
|
2084 | 2105 | |
|
2085 | 2106 | $ ISSUE3669_TIP=`hg tip --template '{node}'` |
|
2086 | 2107 | $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n' |
|
2087 | 2108 | 9 |
|
2088 | 2109 | $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n' |
|
2089 | 2110 | 8 |
|
2090 | 2111 | |
|
2091 | 2112 | test or-ed indirect predicates (issue3775) |
|
2092 | 2113 | |
|
2093 | 2114 | $ log '6 or 6^1' | sort |
|
2094 | 2115 | 5 |
|
2095 | 2116 | 6 |
|
2096 | 2117 | $ log '6^1 or 6' | sort |
|
2097 | 2118 | 5 |
|
2098 | 2119 | 6 |
|
2099 | 2120 | $ log '4 or 4~1' | sort |
|
2100 | 2121 | 2 |
|
2101 | 2122 | 4 |
|
2102 | 2123 | $ log '4~1 or 4' | sort |
|
2103 | 2124 | 2 |
|
2104 | 2125 | 4 |
|
2105 | 2126 | $ log '(0 or 2):(4 or 6) or 0 or 6' | sort |
|
2106 | 2127 | 0 |
|
2107 | 2128 | 1 |
|
2108 | 2129 | 2 |
|
2109 | 2130 | 3 |
|
2110 | 2131 | 4 |
|
2111 | 2132 | 5 |
|
2112 | 2133 | 6 |
|
2113 | 2134 | $ log '0 or 6 or (0 or 2):(4 or 6)' | sort |
|
2114 | 2135 | 0 |
|
2115 | 2136 | 1 |
|
2116 | 2137 | 2 |
|
2117 | 2138 | 3 |
|
2118 | 2139 | 4 |
|
2119 | 2140 | 5 |
|
2120 | 2141 | 6 |
|
2121 | 2142 | |
|
2122 | 2143 | tests for 'remote()' predicate: |
|
2123 | 2144 | #. (csets in remote) (id) (remote) |
|
2124 | 2145 | 1. less than local current branch "default" |
|
2125 | 2146 | 2. same with local specified "default" |
|
2126 | 2147 | 3. more than local specified specified |
|
2127 | 2148 | |
|
2128 | 2149 | $ hg clone --quiet -U . ../remote3 |
|
2129 | 2150 | $ cd ../remote3 |
|
2130 | 2151 | $ hg update -q 7 |
|
2131 | 2152 | $ echo r > r |
|
2132 | 2153 | $ hg ci -Aqm 10 |
|
2133 | 2154 | $ log 'remote()' |
|
2134 | 2155 | 7 |
|
2135 | 2156 | $ log 'remote("a-b-c-")' |
|
2136 | 2157 | 2 |
|
2137 | 2158 | $ cd ../repo |
|
2138 | 2159 | $ log 'remote(".a.b.c.", "../remote3")' |
|
2139 | 2160 | |
|
2140 | 2161 | tests for concatenation of strings/symbols by "##" |
|
2141 | 2162 | |
|
2142 | 2163 | $ try "278 ## '5f5' ## 1ee ## 'ce5'" |
|
2143 | 2164 | (_concat |
|
2144 | 2165 | (_concat |
|
2145 | 2166 | (_concat |
|
2146 | 2167 | ('symbol', '278') |
|
2147 | 2168 | ('string', '5f5')) |
|
2148 | 2169 | ('symbol', '1ee')) |
|
2149 | 2170 | ('string', 'ce5')) |
|
2150 | 2171 | * concatenated: |
|
2151 | 2172 | ('string', '2785f51eece5') |
|
2152 | 2173 | * set: |
|
2153 | 2174 | <baseset [0]> |
|
2154 | 2175 | 0 |
|
2155 | 2176 | |
|
2156 | 2177 | $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc |
|
2157 | 2178 | $ try "cat4(278, '5f5', 1ee, 'ce5')" |
|
2158 | 2179 | (func |
|
2159 | 2180 | ('symbol', 'cat4') |
|
2160 | 2181 | (list |
|
2161 | 2182 | ('symbol', '278') |
|
2162 | 2183 | ('string', '5f5') |
|
2163 | 2184 | ('symbol', '1ee') |
|
2164 | 2185 | ('string', 'ce5'))) |
|
2165 | 2186 | * expanded: |
|
2166 | 2187 | (_concat |
|
2167 | 2188 | (_concat |
|
2168 | 2189 | (_concat |
|
2169 | 2190 | ('symbol', '278') |
|
2170 | 2191 | ('string', '5f5')) |
|
2171 | 2192 | ('symbol', '1ee')) |
|
2172 | 2193 | ('string', 'ce5')) |
|
2173 | 2194 | * concatenated: |
|
2174 | 2195 | ('string', '2785f51eece5') |
|
2175 | 2196 | * set: |
|
2176 | 2197 | <baseset [0]> |
|
2177 | 2198 | 0 |
|
2178 | 2199 | |
|
2179 | 2200 | (check concatenation in alias nesting) |
|
2180 | 2201 | |
|
2181 | 2202 | $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc |
|
2182 | 2203 | $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc |
|
2183 | 2204 | $ log "cat2x2(278, '5f5', 1ee, 'ce5')" |
|
2184 | 2205 | 0 |
|
2185 | 2206 | |
|
2186 | 2207 | (check operator priority) |
|
2187 | 2208 | |
|
2188 | 2209 | $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc |
|
2189 | 2210 | $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)" |
|
2190 | 2211 | 0 |
|
2191 | 2212 | 4 |
|
2192 | 2213 | |
|
2193 | 2214 | $ cd .. |
|
2194 | 2215 | |
|
2195 | 2216 | prepare repository that has "default" branches of multiple roots |
|
2196 | 2217 | |
|
2197 | 2218 | $ hg init namedbranch |
|
2198 | 2219 | $ cd namedbranch |
|
2199 | 2220 | |
|
2200 | 2221 | $ echo default0 >> a |
|
2201 | 2222 | $ hg ci -Aqm0 |
|
2202 | 2223 | $ echo default1 >> a |
|
2203 | 2224 | $ hg ci -m1 |
|
2204 | 2225 | |
|
2205 | 2226 | $ hg branch -q stable |
|
2206 | 2227 | $ echo stable2 >> a |
|
2207 | 2228 | $ hg ci -m2 |
|
2208 | 2229 | $ echo stable3 >> a |
|
2209 | 2230 | $ hg ci -m3 |
|
2210 | 2231 | |
|
2211 | 2232 | $ hg update -q null |
|
2212 | 2233 | $ echo default4 >> a |
|
2213 | 2234 | $ hg ci -Aqm4 |
|
2214 | 2235 | $ echo default5 >> a |
|
2215 | 2236 | $ hg ci -m5 |
|
2216 | 2237 | |
|
2217 | 2238 | "null" revision belongs to "default" branch (issue4683) |
|
2218 | 2239 | |
|
2219 | 2240 | $ log 'branch(null)' |
|
2220 | 2241 | 0 |
|
2221 | 2242 | 1 |
|
2222 | 2243 | 4 |
|
2223 | 2244 | 5 |
|
2224 | 2245 | |
|
2225 | 2246 | "null" revision belongs to "default" branch, but it shouldn't appear in set |
|
2226 | 2247 | unless explicitly specified (issue4682) |
|
2227 | 2248 | |
|
2228 | 2249 | $ log 'children(branch(default))' |
|
2229 | 2250 | 1 |
|
2230 | 2251 | 2 |
|
2231 | 2252 | 5 |
|
2232 | 2253 | |
|
2233 | 2254 | $ cd .. |
|
2234 | 2255 | |
|
2235 | 2256 | test author/desc/keyword in problematic encoding |
|
2236 | 2257 | # unicode: cp932: |
|
2237 | 2258 | # u30A2 0x83 0x41(= 'A') |
|
2238 | 2259 | # u30C2 0x83 0x61(= 'a') |
|
2239 | 2260 | |
|
2240 | 2261 | $ hg init problematicencoding |
|
2241 | 2262 | $ cd problematicencoding |
|
2242 | 2263 | |
|
2243 | 2264 | $ python > setup.sh <<EOF |
|
2244 | 2265 | > print u''' |
|
2245 | 2266 | > echo a > text |
|
2246 | 2267 | > hg add text |
|
2247 | 2268 | > hg --encoding utf-8 commit -u '\u30A2' -m none |
|
2248 | 2269 | > echo b > text |
|
2249 | 2270 | > hg --encoding utf-8 commit -u '\u30C2' -m none |
|
2250 | 2271 | > echo c > text |
|
2251 | 2272 | > hg --encoding utf-8 commit -u none -m '\u30A2' |
|
2252 | 2273 | > echo d > text |
|
2253 | 2274 | > hg --encoding utf-8 commit -u none -m '\u30C2' |
|
2254 | 2275 | > '''.encode('utf-8') |
|
2255 | 2276 | > EOF |
|
2256 | 2277 | $ sh < setup.sh |
|
2257 | 2278 | |
|
2258 | 2279 | test in problematic encoding |
|
2259 | 2280 | $ python > test.sh <<EOF |
|
2260 | 2281 | > print u''' |
|
2261 | 2282 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)' |
|
2262 | 2283 | > echo ==== |
|
2263 | 2284 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)' |
|
2264 | 2285 | > echo ==== |
|
2265 | 2286 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)' |
|
2266 | 2287 | > echo ==== |
|
2267 | 2288 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)' |
|
2268 | 2289 | > echo ==== |
|
2269 | 2290 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)' |
|
2270 | 2291 | > echo ==== |
|
2271 | 2292 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)' |
|
2272 | 2293 | > '''.encode('cp932') |
|
2273 | 2294 | > EOF |
|
2274 | 2295 | $ sh < test.sh |
|
2275 | 2296 | 0 |
|
2276 | 2297 | ==== |
|
2277 | 2298 | 1 |
|
2278 | 2299 | ==== |
|
2279 | 2300 | 2 |
|
2280 | 2301 | ==== |
|
2281 | 2302 | 3 |
|
2282 | 2303 | ==== |
|
2283 | 2304 | 0 |
|
2284 | 2305 | 2 |
|
2285 | 2306 | ==== |
|
2286 | 2307 | 1 |
|
2287 | 2308 | 3 |
|
2288 | 2309 | |
|
2289 | 2310 | test error message of bad revset |
|
2290 | 2311 | $ hg log -r 'foo\\' |
|
2291 | 2312 | hg: parse error at 3: syntax error in revset 'foo\\' |
|
2292 | 2313 | [255] |
|
2293 | 2314 | |
|
2294 | 2315 | $ cd .. |
|
2295 | 2316 | |
|
2296 | 2317 | Test that revset predicate of extension isn't loaded at failure of |
|
2297 | 2318 | loading it |
|
2298 | 2319 | |
|
2299 | 2320 | $ cd repo |
|
2300 | 2321 | |
|
2301 | 2322 | $ cat <<EOF > $TESTTMP/custompredicate.py |
|
2302 | 2323 | > from mercurial import error, registrar, revset |
|
2303 | 2324 | > |
|
2304 | 2325 | > revsetpredicate = registrar.revsetpredicate() |
|
2305 | 2326 | > |
|
2306 | 2327 | > @revsetpredicate('custom1()') |
|
2307 | 2328 | > def custom1(repo, subset, x): |
|
2308 | 2329 | > return revset.baseset([1]) |
|
2309 | 2330 | > |
|
2310 | 2331 | > raise error.Abort('intentional failure of loading extension') |
|
2311 | 2332 | > EOF |
|
2312 | 2333 | $ cat <<EOF > .hg/hgrc |
|
2313 | 2334 | > [extensions] |
|
2314 | 2335 | > custompredicate = $TESTTMP/custompredicate.py |
|
2315 | 2336 | > EOF |
|
2316 | 2337 | |
|
2317 | 2338 | $ hg debugrevspec "custom1()" |
|
2318 | 2339 | *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension |
|
2319 | 2340 | hg: parse error: unknown identifier: custom1 |
|
2320 | 2341 | [255] |
|
2321 | 2342 | |
|
2322 | 2343 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now