Show More
@@ -1,1388 +1,1402 b'' | |||
|
1 | 1 | $ HGENCODING=utf-8 |
|
2 | 2 | $ export HGENCODING |
|
3 | 3 | |
|
4 | 4 | $ try() { |
|
5 | 5 | > hg debugrevspec --debug "$@" |
|
6 | 6 | > } |
|
7 | 7 | |
|
8 | 8 | $ log() { |
|
9 | 9 | > hg log --template '{rev}\n' -r "$1" |
|
10 | 10 | > } |
|
11 | 11 | |
|
12 | 12 | $ hg init repo |
|
13 | 13 | $ cd repo |
|
14 | 14 | |
|
15 | 15 | $ echo a > a |
|
16 | 16 | $ hg branch a |
|
17 | 17 | marked working directory as branch a |
|
18 | 18 | (branches are permanent and global, did you want a bookmark?) |
|
19 | 19 | $ hg ci -Aqm0 |
|
20 | 20 | |
|
21 | 21 | $ echo b > b |
|
22 | 22 | $ hg branch b |
|
23 | 23 | marked working directory as branch b |
|
24 | 24 | (branches are permanent and global, did you want a bookmark?) |
|
25 | 25 | $ hg ci -Aqm1 |
|
26 | 26 | |
|
27 | 27 | $ rm a |
|
28 | 28 | $ hg branch a-b-c- |
|
29 | 29 | marked working directory as branch a-b-c- |
|
30 | 30 | (branches are permanent and global, did you want a bookmark?) |
|
31 | 31 | $ hg ci -Aqm2 -u Bob |
|
32 | 32 | |
|
33 | 33 | $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n' |
|
34 | 34 | 2 |
|
35 | 35 | $ hg log -r "extra('branch')" --template '{rev}\n' |
|
36 | 36 | 0 |
|
37 | 37 | 1 |
|
38 | 38 | 2 |
|
39 | 39 | $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n' |
|
40 | 40 | 0 a |
|
41 | 41 | 2 a-b-c- |
|
42 | 42 | |
|
43 | 43 | $ hg co 1 |
|
44 | 44 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
45 | 45 | $ hg branch +a+b+c+ |
|
46 | 46 | marked working directory as branch +a+b+c+ |
|
47 | 47 | (branches are permanent and global, did you want a bookmark?) |
|
48 | 48 | $ hg ci -Aqm3 |
|
49 | 49 | |
|
50 | 50 | $ hg co 2 # interleave |
|
51 | 51 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
52 | 52 | $ echo bb > b |
|
53 | 53 | $ hg branch -- -a-b-c- |
|
54 | 54 | marked working directory as branch -a-b-c- |
|
55 | 55 | (branches are permanent and global, did you want a bookmark?) |
|
56 | 56 | $ hg ci -Aqm4 -d "May 12 2005" |
|
57 | 57 | |
|
58 | 58 | $ hg co 3 |
|
59 | 59 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
60 | 60 | $ hg branch !a/b/c/ |
|
61 | 61 | marked working directory as branch !a/b/c/ |
|
62 | 62 | (branches are permanent and global, did you want a bookmark?) |
|
63 | 63 | $ hg ci -Aqm"5 bug" |
|
64 | 64 | |
|
65 | 65 | $ hg merge 4 |
|
66 | 66 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
67 | 67 | (branch merge, don't forget to commit) |
|
68 | 68 | $ hg branch _a_b_c_ |
|
69 | 69 | marked working directory as branch _a_b_c_ |
|
70 | 70 | (branches are permanent and global, did you want a bookmark?) |
|
71 | 71 | $ hg ci -Aqm"6 issue619" |
|
72 | 72 | |
|
73 | 73 | $ hg branch .a.b.c. |
|
74 | 74 | marked working directory as branch .a.b.c. |
|
75 | 75 | (branches are permanent and global, did you want a bookmark?) |
|
76 | 76 | $ hg ci -Aqm7 |
|
77 | 77 | |
|
78 | 78 | $ hg branch all |
|
79 | 79 | marked working directory as branch all |
|
80 | 80 | (branches are permanent and global, did you want a bookmark?) |
|
81 | 81 | |
|
82 | 82 | $ hg co 4 |
|
83 | 83 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
84 | 84 | $ hg branch Γ© |
|
85 | 85 | marked working directory as branch \xc3\xa9 (esc) |
|
86 | 86 | (branches are permanent and global, did you want a bookmark?) |
|
87 | 87 | $ hg ci -Aqm9 |
|
88 | 88 | |
|
89 | 89 | $ hg tag -r6 1.0 |
|
90 | 90 | |
|
91 | 91 | $ hg clone --quiet -U -r 7 . ../remote1 |
|
92 | 92 | $ hg clone --quiet -U -r 8 . ../remote2 |
|
93 | 93 | $ echo "[paths]" >> .hg/hgrc |
|
94 | 94 | $ echo "default = ../remote1" >> .hg/hgrc |
|
95 | 95 | |
|
96 | 96 | names that should work without quoting |
|
97 | 97 | |
|
98 | 98 | $ try a |
|
99 | 99 | ('symbol', 'a') |
|
100 | 100 | 0 |
|
101 | 101 | $ try b-a |
|
102 | 102 | (minus |
|
103 | 103 | ('symbol', 'b') |
|
104 | 104 | ('symbol', 'a')) |
|
105 | 105 | 1 |
|
106 | 106 | $ try _a_b_c_ |
|
107 | 107 | ('symbol', '_a_b_c_') |
|
108 | 108 | 6 |
|
109 | 109 | $ try _a_b_c_-a |
|
110 | 110 | (minus |
|
111 | 111 | ('symbol', '_a_b_c_') |
|
112 | 112 | ('symbol', 'a')) |
|
113 | 113 | 6 |
|
114 | 114 | $ try .a.b.c. |
|
115 | 115 | ('symbol', '.a.b.c.') |
|
116 | 116 | 7 |
|
117 | 117 | $ try .a.b.c.-a |
|
118 | 118 | (minus |
|
119 | 119 | ('symbol', '.a.b.c.') |
|
120 | 120 | ('symbol', 'a')) |
|
121 | 121 | 7 |
|
122 | 122 | $ try -- '-a-b-c-' # complains |
|
123 | 123 | hg: parse error at 7: not a prefix: end |
|
124 | 124 | [255] |
|
125 | 125 | $ log -a-b-c- # succeeds with fallback |
|
126 | 126 | 4 |
|
127 | 127 | |
|
128 | 128 | $ try -- -a-b-c--a # complains |
|
129 | 129 | (minus |
|
130 | 130 | (minus |
|
131 | 131 | (minus |
|
132 | 132 | (negate |
|
133 | 133 | ('symbol', 'a')) |
|
134 | 134 | ('symbol', 'b')) |
|
135 | 135 | ('symbol', 'c')) |
|
136 | 136 | (negate |
|
137 | 137 | ('symbol', 'a'))) |
|
138 | 138 | abort: unknown revision '-a'! |
|
139 | 139 | [255] |
|
140 | 140 | $ try Γ© |
|
141 | 141 | ('symbol', '\xc3\xa9') |
|
142 | 142 | 9 |
|
143 | 143 | |
|
144 | 144 | no quoting needed |
|
145 | 145 | |
|
146 | 146 | $ log ::a-b-c- |
|
147 | 147 | 0 |
|
148 | 148 | 1 |
|
149 | 149 | 2 |
|
150 | 150 | |
|
151 | 151 | quoting needed |
|
152 | 152 | |
|
153 | 153 | $ try '"-a-b-c-"-a' |
|
154 | 154 | (minus |
|
155 | 155 | ('string', '-a-b-c-') |
|
156 | 156 | ('symbol', 'a')) |
|
157 | 157 | 4 |
|
158 | 158 | |
|
159 | 159 | $ log '1 or 2' |
|
160 | 160 | 1 |
|
161 | 161 | 2 |
|
162 | 162 | $ log '1|2' |
|
163 | 163 | 1 |
|
164 | 164 | 2 |
|
165 | 165 | $ log '1 and 2' |
|
166 | 166 | $ log '1&2' |
|
167 | 167 | $ try '1&2|3' # precedence - and is higher |
|
168 | 168 | (or |
|
169 | 169 | (and |
|
170 | 170 | ('symbol', '1') |
|
171 | 171 | ('symbol', '2')) |
|
172 | 172 | ('symbol', '3')) |
|
173 | 173 | 3 |
|
174 | 174 | $ try '1|2&3' |
|
175 | 175 | (or |
|
176 | 176 | ('symbol', '1') |
|
177 | 177 | (and |
|
178 | 178 | ('symbol', '2') |
|
179 | 179 | ('symbol', '3'))) |
|
180 | 180 | 1 |
|
181 | 181 | $ try '1&2&3' # associativity |
|
182 | 182 | (and |
|
183 | 183 | (and |
|
184 | 184 | ('symbol', '1') |
|
185 | 185 | ('symbol', '2')) |
|
186 | 186 | ('symbol', '3')) |
|
187 | 187 | $ try '1|(2|3)' |
|
188 | 188 | (or |
|
189 | 189 | ('symbol', '1') |
|
190 | 190 | (group |
|
191 | 191 | (or |
|
192 | 192 | ('symbol', '2') |
|
193 | 193 | ('symbol', '3')))) |
|
194 | 194 | 1 |
|
195 | 195 | 2 |
|
196 | 196 | 3 |
|
197 | 197 | $ log '1.0' # tag |
|
198 | 198 | 6 |
|
199 | 199 | $ log 'a' # branch |
|
200 | 200 | 0 |
|
201 | 201 | $ log '2785f51ee' |
|
202 | 202 | 0 |
|
203 | 203 | $ log 'date(2005)' |
|
204 | 204 | 4 |
|
205 | 205 | $ log 'date(this is a test)' |
|
206 | 206 | hg: parse error at 10: unexpected token: symbol |
|
207 | 207 | [255] |
|
208 | 208 | $ log 'date()' |
|
209 | 209 | hg: parse error: date requires a string |
|
210 | 210 | [255] |
|
211 | 211 | $ log 'date' |
|
212 | 212 | hg: parse error: can't use date here |
|
213 | 213 | [255] |
|
214 | 214 | $ log 'date(' |
|
215 | 215 | hg: parse error at 5: not a prefix: end |
|
216 | 216 | [255] |
|
217 | 217 | $ log 'date(tip)' |
|
218 | 218 | abort: invalid date: 'tip' |
|
219 | 219 | [255] |
|
220 | 220 | $ log '"date"' |
|
221 | 221 | abort: unknown revision 'date'! |
|
222 | 222 | [255] |
|
223 | 223 | $ log 'date(2005) and 1::' |
|
224 | 224 | 4 |
|
225 | 225 | |
|
226 | 226 | ancestor can accept 0 or more arguments |
|
227 | 227 | |
|
228 | 228 | $ log 'ancestor()' |
|
229 | 229 | $ log 'ancestor(1)' |
|
230 | 230 | 1 |
|
231 | 231 | $ log 'ancestor(4,5)' |
|
232 | 232 | 1 |
|
233 | 233 | $ log 'ancestor(4,5) and 4' |
|
234 | 234 | $ log 'ancestor(0,0,1,3)' |
|
235 | 235 | 0 |
|
236 | 236 | $ log 'ancestor(3,1,5,3,5,1)' |
|
237 | 237 | 1 |
|
238 | 238 | $ log 'ancestor(0,1,3,5)' |
|
239 | 239 | 0 |
|
240 | 240 | $ log 'ancestor(1,2,3,4,5)' |
|
241 | 241 | 1 |
|
242 | 242 | $ log 'ancestors(5)' |
|
243 | 243 | 0 |
|
244 | 244 | 1 |
|
245 | 245 | 3 |
|
246 | 246 | 5 |
|
247 | 247 | $ log 'ancestor(ancestors(5))' |
|
248 | 248 | 0 |
|
249 | 249 | $ log 'author(bob)' |
|
250 | 250 | 2 |
|
251 | 251 | $ log 'author("re:bob|test")' |
|
252 | 252 | 0 |
|
253 | 253 | 1 |
|
254 | 254 | 2 |
|
255 | 255 | 3 |
|
256 | 256 | 4 |
|
257 | 257 | 5 |
|
258 | 258 | 6 |
|
259 | 259 | 7 |
|
260 | 260 | 8 |
|
261 | 261 | 9 |
|
262 | 262 | $ log 'branch(Γ©)' |
|
263 | 263 | 8 |
|
264 | 264 | 9 |
|
265 | 265 | $ log 'branch(a)' |
|
266 | 266 | 0 |
|
267 | 267 | $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n' |
|
268 | 268 | 0 a |
|
269 | 269 | 2 a-b-c- |
|
270 | 270 | 3 +a+b+c+ |
|
271 | 271 | 4 -a-b-c- |
|
272 | 272 | 5 !a/b/c/ |
|
273 | 273 | 6 _a_b_c_ |
|
274 | 274 | 7 .a.b.c. |
|
275 | 275 | $ log 'children(ancestor(4,5))' |
|
276 | 276 | 2 |
|
277 | 277 | 3 |
|
278 | 278 | $ log 'closed()' |
|
279 | 279 | $ log 'contains(a)' |
|
280 | 280 | 0 |
|
281 | 281 | 1 |
|
282 | 282 | 3 |
|
283 | 283 | 5 |
|
284 | 284 | $ log 'contains("../repo/a")' |
|
285 | 285 | 0 |
|
286 | 286 | 1 |
|
287 | 287 | 3 |
|
288 | 288 | 5 |
|
289 | 289 | $ log 'desc(B)' |
|
290 | 290 | 5 |
|
291 | 291 | $ log 'descendants(2 or 3)' |
|
292 | 292 | 2 |
|
293 | 293 | 3 |
|
294 | 294 | 4 |
|
295 | 295 | 5 |
|
296 | 296 | 6 |
|
297 | 297 | 7 |
|
298 | 298 | 8 |
|
299 | 299 | 9 |
|
300 | 300 | $ log 'file("b*")' |
|
301 | 301 | 1 |
|
302 | 302 | 4 |
|
303 | 303 | $ log 'filelog("b")' |
|
304 | 304 | 1 |
|
305 | 305 | 4 |
|
306 | 306 | $ log 'filelog("../repo/b")' |
|
307 | 307 | 1 |
|
308 | 308 | 4 |
|
309 | 309 | $ log 'follow()' |
|
310 | 310 | 0 |
|
311 | 311 | 1 |
|
312 | 312 | 2 |
|
313 | 313 | 4 |
|
314 | 314 | 8 |
|
315 | 315 | 9 |
|
316 | 316 | $ log 'grep("issue\d+")' |
|
317 | 317 | 6 |
|
318 | 318 | $ try 'grep("(")' # invalid regular expression |
|
319 | 319 | (func |
|
320 | 320 | ('symbol', 'grep') |
|
321 | 321 | ('string', '(')) |
|
322 | 322 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
323 | 323 | [255] |
|
324 | 324 | $ try 'grep("\bissue\d+")' |
|
325 | 325 | (func |
|
326 | 326 | ('symbol', 'grep') |
|
327 | 327 | ('string', '\x08issue\\d+')) |
|
328 | 328 | $ try 'grep(r"\bissue\d+")' |
|
329 | 329 | (func |
|
330 | 330 | ('symbol', 'grep') |
|
331 | 331 | ('string', '\\bissue\\d+')) |
|
332 | 332 | 6 |
|
333 | 333 | $ try 'grep(r"\")' |
|
334 | 334 | hg: parse error at 7: unterminated string |
|
335 | 335 | [255] |
|
336 | 336 | $ log 'head()' |
|
337 | 337 | 0 |
|
338 | 338 | 1 |
|
339 | 339 | 2 |
|
340 | 340 | 3 |
|
341 | 341 | 4 |
|
342 | 342 | 5 |
|
343 | 343 | 6 |
|
344 | 344 | 7 |
|
345 | 345 | 9 |
|
346 | 346 | $ log 'heads(6::)' |
|
347 | 347 | 7 |
|
348 | 348 | $ log 'keyword(issue)' |
|
349 | 349 | 6 |
|
350 | 350 | $ log 'keyword("test a")' |
|
351 | 351 | $ log 'limit(head(), 1)' |
|
352 | 352 | 0 |
|
353 | 353 | $ log 'matching(6)' |
|
354 | 354 | 6 |
|
355 | 355 | $ log 'matching(6:7, "phase parents user date branch summary files description substate")' |
|
356 | 356 | 6 |
|
357 | 357 | 7 |
|
358 | 358 | |
|
359 | 359 | Testing min and max |
|
360 | 360 | |
|
361 | 361 | max: simple |
|
362 | 362 | |
|
363 | 363 | $ log 'max(contains(a))' |
|
364 | 364 | 5 |
|
365 | 365 | |
|
366 | 366 | max: simple on unordered set) |
|
367 | 367 | |
|
368 | 368 | $ log 'max((4+0+2+5+7) and contains(a))' |
|
369 | 369 | 5 |
|
370 | 370 | |
|
371 | 371 | max: no result |
|
372 | 372 | |
|
373 | 373 | $ log 'max(contains(stringthatdoesnotappearanywhere))' |
|
374 | 374 | |
|
375 | 375 | max: no result on unordered set |
|
376 | 376 | |
|
377 | 377 | $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' |
|
378 | 378 | |
|
379 | 379 | min: simple |
|
380 | 380 | |
|
381 | 381 | $ log 'min(contains(a))' |
|
382 | 382 | 0 |
|
383 | 383 | |
|
384 | 384 | min: simple on unordered set |
|
385 | 385 | |
|
386 | 386 | $ log 'min((4+0+2+5+7) and contains(a))' |
|
387 | 387 | 0 |
|
388 | 388 | |
|
389 | 389 | min: empty |
|
390 | 390 | |
|
391 | 391 | $ log 'min(contains(stringthatdoesnotappearanywhere))' |
|
392 | 392 | |
|
393 | 393 | min: empty on unordered set |
|
394 | 394 | |
|
395 | 395 | $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' |
|
396 | 396 | |
|
397 | 397 | |
|
398 | 398 | $ log 'merge()' |
|
399 | 399 | 6 |
|
400 | 400 | $ log 'branchpoint()' |
|
401 | 401 | 1 |
|
402 | 402 | 4 |
|
403 | 403 | $ log 'modifies(b)' |
|
404 | 404 | 4 |
|
405 | 405 | $ log 'modifies("path:b")' |
|
406 | 406 | 4 |
|
407 | 407 | $ log 'modifies("*")' |
|
408 | 408 | 4 |
|
409 | 409 | 6 |
|
410 | 410 | $ log 'modifies("set:modified()")' |
|
411 | 411 | 4 |
|
412 | 412 | $ log 'id(5)' |
|
413 | 413 | 2 |
|
414 | 414 | $ log 'only(9)' |
|
415 | 415 | 8 |
|
416 | 416 | 9 |
|
417 | 417 | $ log 'only(8)' |
|
418 | 418 | 8 |
|
419 | 419 | $ log 'only(9, 5)' |
|
420 | 420 | 2 |
|
421 | 421 | 4 |
|
422 | 422 | 8 |
|
423 | 423 | 9 |
|
424 | 424 | $ log 'only(7 + 9, 5 + 2)' |
|
425 | 425 | 4 |
|
426 | 426 | 6 |
|
427 | 427 | 7 |
|
428 | 428 | 8 |
|
429 | 429 | 9 |
|
430 | 430 | |
|
431 | 431 | Test empty set input |
|
432 | 432 | $ log 'only(p2())' |
|
433 | 433 | $ log 'only(p1(), p2())' |
|
434 | 434 | 0 |
|
435 | 435 | 1 |
|
436 | 436 | 2 |
|
437 | 437 | 4 |
|
438 | 438 | 8 |
|
439 | 439 | 9 |
|
440 | 440 | |
|
441 | 441 | Test '%' operator |
|
442 | 442 | |
|
443 | 443 | $ log '9%' |
|
444 | 444 | 8 |
|
445 | 445 | 9 |
|
446 | 446 | $ log '9%5' |
|
447 | 447 | 2 |
|
448 | 448 | 4 |
|
449 | 449 | 8 |
|
450 | 450 | 9 |
|
451 | 451 | $ log '(7 + 9)%(5 + 2)' |
|
452 | 452 | 4 |
|
453 | 453 | 6 |
|
454 | 454 | 7 |
|
455 | 455 | 8 |
|
456 | 456 | 9 |
|
457 | 457 | |
|
458 | 458 | Test the order of operations |
|
459 | 459 | |
|
460 | 460 | $ log '7 + 9%5 + 2' |
|
461 | 461 | 7 |
|
462 | 462 | 2 |
|
463 | 463 | 4 |
|
464 | 464 | 8 |
|
465 | 465 | 9 |
|
466 | 466 | |
|
467 | 467 | Test explicit numeric revision |
|
468 | 468 | $ log 'rev(-2)' |
|
469 | 469 | $ log 'rev(-1)' |
|
470 | 470 | -1 |
|
471 | 471 | $ log 'rev(0)' |
|
472 | 472 | 0 |
|
473 | 473 | $ log 'rev(9)' |
|
474 | 474 | 9 |
|
475 | 475 | $ log 'rev(10)' |
|
476 | 476 | $ log 'rev(tip)' |
|
477 | 477 | hg: parse error: rev expects a number |
|
478 | 478 | [255] |
|
479 | 479 | |
|
480 | 480 | Test null revision |
|
481 | 481 | $ log '(null)' |
|
482 | 482 | -1 |
|
483 | 483 | $ log '(null:0)' |
|
484 | 484 | -1 |
|
485 | 485 | 0 |
|
486 | 486 | $ log '(0:null)' |
|
487 | 487 | 0 |
|
488 | 488 | -1 |
|
489 | 489 | $ log 'null::0' |
|
490 | 490 | -1 |
|
491 | 491 | 0 |
|
492 | 492 | $ log 'null:tip - 0:' |
|
493 | 493 | -1 |
|
494 | 494 | $ log 'null: and null::' | head -1 |
|
495 | 495 | -1 |
|
496 | 496 | $ log 'null: or 0:' | head -2 |
|
497 | 497 | -1 |
|
498 | 498 | 0 |
|
499 | 499 | $ log 'ancestors(null)' |
|
500 | 500 | -1 |
|
501 | 501 | $ log 'reverse(null:)' | tail -2 |
|
502 | 502 | 0 |
|
503 | 503 | -1 |
|
504 | 504 | $ log 'first(null:)' |
|
505 | 505 | -1 |
|
506 | 506 | $ log 'min(null:)' |
|
507 | 507 | -1 |
|
508 | 508 | $ log 'tip:null and all()' | tail -2 |
|
509 | 509 | 1 |
|
510 | 510 | 0 |
|
511 | 511 | |
|
512 | 512 | $ log 'outgoing()' |
|
513 | 513 | 8 |
|
514 | 514 | 9 |
|
515 | 515 | $ log 'outgoing("../remote1")' |
|
516 | 516 | 8 |
|
517 | 517 | 9 |
|
518 | 518 | $ log 'outgoing("../remote2")' |
|
519 | 519 | 3 |
|
520 | 520 | 5 |
|
521 | 521 | 6 |
|
522 | 522 | 7 |
|
523 | 523 | 9 |
|
524 | 524 | $ log 'p1(merge())' |
|
525 | 525 | 5 |
|
526 | 526 | $ log 'p2(merge())' |
|
527 | 527 | 4 |
|
528 | 528 | $ log 'parents(merge())' |
|
529 | 529 | 4 |
|
530 | 530 | 5 |
|
531 | 531 | $ log 'p1(branchpoint())' |
|
532 | 532 | 0 |
|
533 | 533 | 2 |
|
534 | 534 | $ log 'p2(branchpoint())' |
|
535 | 535 | $ log 'parents(branchpoint())' |
|
536 | 536 | 0 |
|
537 | 537 | 2 |
|
538 | 538 | $ log 'removes(a)' |
|
539 | 539 | 2 |
|
540 | 540 | 6 |
|
541 | 541 | $ log 'roots(all())' |
|
542 | 542 | 0 |
|
543 | 543 | $ log 'reverse(2 or 3 or 4 or 5)' |
|
544 | 544 | 5 |
|
545 | 545 | 4 |
|
546 | 546 | 3 |
|
547 | 547 | 2 |
|
548 | 548 | $ log 'reverse(all())' |
|
549 | 549 | 9 |
|
550 | 550 | 8 |
|
551 | 551 | 7 |
|
552 | 552 | 6 |
|
553 | 553 | 5 |
|
554 | 554 | 4 |
|
555 | 555 | 3 |
|
556 | 556 | 2 |
|
557 | 557 | 1 |
|
558 | 558 | 0 |
|
559 | 559 | $ log 'reverse(all()) & filelog(b)' |
|
560 | 560 | 4 |
|
561 | 561 | 1 |
|
562 | 562 | $ log 'rev(5)' |
|
563 | 563 | 5 |
|
564 | 564 | $ log 'sort(limit(reverse(all()), 3))' |
|
565 | 565 | 7 |
|
566 | 566 | 8 |
|
567 | 567 | 9 |
|
568 | 568 | $ log 'sort(2 or 3 or 4 or 5, date)' |
|
569 | 569 | 2 |
|
570 | 570 | 3 |
|
571 | 571 | 5 |
|
572 | 572 | 4 |
|
573 | 573 | $ log 'tagged()' |
|
574 | 574 | 6 |
|
575 | 575 | $ log 'tag()' |
|
576 | 576 | 6 |
|
577 | 577 | $ log 'tag(1.0)' |
|
578 | 578 | 6 |
|
579 | 579 | $ log 'tag(tip)' |
|
580 | 580 | 9 |
|
581 | 581 | |
|
582 | 582 | test sort revset |
|
583 | 583 | -------------------------------------------- |
|
584 | 584 | |
|
585 | 585 | test when adding two unordered revsets |
|
586 | 586 | |
|
587 | 587 | $ log 'sort(keyword(issue) or modifies(b))' |
|
588 | 588 | 4 |
|
589 | 589 | 6 |
|
590 | 590 | |
|
591 | 591 | test when sorting a reversed collection in the same way it is |
|
592 | 592 | |
|
593 | 593 | $ log 'sort(reverse(all()), -rev)' |
|
594 | 594 | 9 |
|
595 | 595 | 8 |
|
596 | 596 | 7 |
|
597 | 597 | 6 |
|
598 | 598 | 5 |
|
599 | 599 | 4 |
|
600 | 600 | 3 |
|
601 | 601 | 2 |
|
602 | 602 | 1 |
|
603 | 603 | 0 |
|
604 | 604 | |
|
605 | 605 | test when sorting a reversed collection |
|
606 | 606 | |
|
607 | 607 | $ log 'sort(reverse(all()), rev)' |
|
608 | 608 | 0 |
|
609 | 609 | 1 |
|
610 | 610 | 2 |
|
611 | 611 | 3 |
|
612 | 612 | 4 |
|
613 | 613 | 5 |
|
614 | 614 | 6 |
|
615 | 615 | 7 |
|
616 | 616 | 8 |
|
617 | 617 | 9 |
|
618 | 618 | |
|
619 | 619 | |
|
620 | 620 | test sorting two sorted collections in different orders |
|
621 | 621 | |
|
622 | 622 | $ log 'sort(outgoing() or reverse(removes(a)), rev)' |
|
623 | 623 | 2 |
|
624 | 624 | 6 |
|
625 | 625 | 8 |
|
626 | 626 | 9 |
|
627 | 627 | |
|
628 | 628 | test sorting two sorted collections in different orders backwards |
|
629 | 629 | |
|
630 | 630 | $ log 'sort(outgoing() or reverse(removes(a)), -rev)' |
|
631 | 631 | 9 |
|
632 | 632 | 8 |
|
633 | 633 | 6 |
|
634 | 634 | 2 |
|
635 | 635 | |
|
636 | 636 | test subtracting something from an addset |
|
637 | 637 | |
|
638 | 638 | $ log '(outgoing() or removes(a)) - removes(a)' |
|
639 | 639 | 8 |
|
640 | 640 | 9 |
|
641 | 641 | |
|
642 | 642 | test intersecting something with an addset |
|
643 | 643 | |
|
644 | 644 | $ log 'parents(outgoing() or removes(a))' |
|
645 | 645 | 1 |
|
646 | 646 | 4 |
|
647 | 647 | 5 |
|
648 | 648 | 8 |
|
649 | 649 | |
|
650 | 650 | test that `or` operation combines elements in the right order: |
|
651 | 651 | |
|
652 | 652 | $ log '3:4 or 2:5' |
|
653 | 653 | 3 |
|
654 | 654 | 4 |
|
655 | 655 | 2 |
|
656 | 656 | 5 |
|
657 | 657 | $ log '3:4 or 5:2' |
|
658 | 658 | 3 |
|
659 | 659 | 4 |
|
660 | 660 | 5 |
|
661 | 661 | 2 |
|
662 | 662 | $ log 'sort(3:4 or 2:5)' |
|
663 | 663 | 2 |
|
664 | 664 | 3 |
|
665 | 665 | 4 |
|
666 | 666 | 5 |
|
667 | 667 | $ log 'sort(3:4 or 5:2)' |
|
668 | 668 | 2 |
|
669 | 669 | 3 |
|
670 | 670 | 4 |
|
671 | 671 | 5 |
|
672 | 672 | |
|
673 | 673 | check that conversion to only works |
|
674 | 674 | $ try --optimize '::3 - ::1' |
|
675 | 675 | (minus |
|
676 | 676 | (dagrangepre |
|
677 | 677 | ('symbol', '3')) |
|
678 | 678 | (dagrangepre |
|
679 | 679 | ('symbol', '1'))) |
|
680 | 680 | * optimized: |
|
681 | 681 | (func |
|
682 | 682 | ('symbol', 'only') |
|
683 | 683 | (list |
|
684 | 684 | ('symbol', '3') |
|
685 | 685 | ('symbol', '1'))) |
|
686 | 686 | 3 |
|
687 | 687 | $ try --optimize 'ancestors(1) - ancestors(3)' |
|
688 | 688 | (minus |
|
689 | 689 | (func |
|
690 | 690 | ('symbol', 'ancestors') |
|
691 | 691 | ('symbol', '1')) |
|
692 | 692 | (func |
|
693 | 693 | ('symbol', 'ancestors') |
|
694 | 694 | ('symbol', '3'))) |
|
695 | 695 | * optimized: |
|
696 | 696 | (func |
|
697 | 697 | ('symbol', 'only') |
|
698 | 698 | (list |
|
699 | 699 | ('symbol', '1') |
|
700 | 700 | ('symbol', '3'))) |
|
701 | 701 | $ try --optimize 'not ::2 and ::6' |
|
702 | 702 | (and |
|
703 | 703 | (not |
|
704 | 704 | (dagrangepre |
|
705 | 705 | ('symbol', '2'))) |
|
706 | 706 | (dagrangepre |
|
707 | 707 | ('symbol', '6'))) |
|
708 | 708 | * optimized: |
|
709 | 709 | (func |
|
710 | 710 | ('symbol', 'only') |
|
711 | 711 | (list |
|
712 | 712 | ('symbol', '6') |
|
713 | 713 | ('symbol', '2'))) |
|
714 | 714 | 3 |
|
715 | 715 | 4 |
|
716 | 716 | 5 |
|
717 | 717 | 6 |
|
718 | 718 | $ try --optimize 'ancestors(6) and not ancestors(4)' |
|
719 | 719 | (and |
|
720 | 720 | (func |
|
721 | 721 | ('symbol', 'ancestors') |
|
722 | 722 | ('symbol', '6')) |
|
723 | 723 | (not |
|
724 | 724 | (func |
|
725 | 725 | ('symbol', 'ancestors') |
|
726 | 726 | ('symbol', '4')))) |
|
727 | 727 | * optimized: |
|
728 | 728 | (func |
|
729 | 729 | ('symbol', 'only') |
|
730 | 730 | (list |
|
731 | 731 | ('symbol', '6') |
|
732 | 732 | ('symbol', '4'))) |
|
733 | 733 | 3 |
|
734 | 734 | 5 |
|
735 | 735 | 6 |
|
736 | 736 | |
|
737 | 737 | we can use patterns when searching for tags |
|
738 | 738 | |
|
739 | 739 | $ log 'tag("1..*")' |
|
740 | 740 | abort: tag '1..*' does not exist! |
|
741 | 741 | [255] |
|
742 | 742 | $ log 'tag("re:1..*")' |
|
743 | 743 | 6 |
|
744 | 744 | $ log 'tag("re:[0-9].[0-9]")' |
|
745 | 745 | 6 |
|
746 | 746 | $ log 'tag("literal:1.0")' |
|
747 | 747 | 6 |
|
748 | 748 | $ log 'tag("re:0..*")' |
|
749 | 749 | |
|
750 | 750 | $ log 'tag(unknown)' |
|
751 | 751 | abort: tag 'unknown' does not exist! |
|
752 | 752 | [255] |
|
753 | 753 | $ log 'tag("re:unknown")' |
|
754 | 754 | $ log 'present(tag("unknown"))' |
|
755 | 755 | $ log 'present(tag("re:unknown"))' |
|
756 | 756 | $ log 'branch(unknown)' |
|
757 | 757 | abort: unknown revision 'unknown'! |
|
758 | 758 | [255] |
|
759 | 759 | $ log 'branch("re:unknown")' |
|
760 | 760 | $ log 'present(branch("unknown"))' |
|
761 | 761 | $ log 'present(branch("re:unknown"))' |
|
762 | 762 | $ log 'user(bob)' |
|
763 | 763 | 2 |
|
764 | 764 | |
|
765 | 765 | $ log '4::8' |
|
766 | 766 | 4 |
|
767 | 767 | 8 |
|
768 | 768 | $ log '4:8' |
|
769 | 769 | 4 |
|
770 | 770 | 5 |
|
771 | 771 | 6 |
|
772 | 772 | 7 |
|
773 | 773 | 8 |
|
774 | 774 | |
|
775 | 775 | $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' |
|
776 | 776 | 4 |
|
777 | 777 | 2 |
|
778 | 778 | 5 |
|
779 | 779 | |
|
780 | 780 | $ log 'not 0 and 0:2' |
|
781 | 781 | 1 |
|
782 | 782 | 2 |
|
783 | 783 | $ log 'not 1 and 0:2' |
|
784 | 784 | 0 |
|
785 | 785 | 2 |
|
786 | 786 | $ log 'not 2 and 0:2' |
|
787 | 787 | 0 |
|
788 | 788 | 1 |
|
789 | 789 | $ log '(1 and 2)::' |
|
790 | 790 | $ log '(1 and 2):' |
|
791 | 791 | $ log '(1 and 2):3' |
|
792 | 792 | $ log 'sort(head(), -rev)' |
|
793 | 793 | 9 |
|
794 | 794 | 7 |
|
795 | 795 | 6 |
|
796 | 796 | 5 |
|
797 | 797 | 4 |
|
798 | 798 | 3 |
|
799 | 799 | 2 |
|
800 | 800 | 1 |
|
801 | 801 | 0 |
|
802 | 802 | $ log '4::8 - 8' |
|
803 | 803 | 4 |
|
804 | 804 | $ log 'matching(1 or 2 or 3) and (2 or 3 or 1)' |
|
805 | 805 | 2 |
|
806 | 806 | 3 |
|
807 | 807 | 1 |
|
808 | 808 | |
|
809 | 809 | $ log 'named("unknown")' |
|
810 | 810 | abort: namespace 'unknown' does not exist! |
|
811 | 811 | [255] |
|
812 | 812 | $ log 'named("re:unknown")' |
|
813 | 813 | abort: no namespace exists that match 'unknown'! |
|
814 | 814 | [255] |
|
815 | 815 | $ log 'present(named("unknown"))' |
|
816 | 816 | $ log 'present(named("re:unknown"))' |
|
817 | 817 | |
|
818 | 818 | $ log 'tag()' |
|
819 | 819 | 6 |
|
820 | 820 | $ log 'named("tags")' |
|
821 | 821 | 6 |
|
822 | 822 | |
|
823 | 823 | issue2437 |
|
824 | 824 | |
|
825 | 825 | $ log '3 and p1(5)' |
|
826 | 826 | 3 |
|
827 | 827 | $ log '4 and p2(6)' |
|
828 | 828 | 4 |
|
829 | 829 | $ log '1 and parents(:2)' |
|
830 | 830 | 1 |
|
831 | 831 | $ log '2 and children(1:)' |
|
832 | 832 | 2 |
|
833 | 833 | $ log 'roots(all()) or roots(all())' |
|
834 | 834 | 0 |
|
835 | 835 | $ hg debugrevspec 'roots(all()) or roots(all())' |
|
836 | 836 | 0 |
|
837 | 837 | $ log 'heads(branch(Γ©)) or heads(branch(Γ©))' |
|
838 | 838 | 9 |
|
839 | 839 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))' |
|
840 | 840 | 4 |
|
841 | 841 | |
|
842 | 842 | issue2654: report a parse error if the revset was not completely parsed |
|
843 | 843 | |
|
844 | 844 | $ log '1 OR 2' |
|
845 | 845 | hg: parse error at 2: invalid token |
|
846 | 846 | [255] |
|
847 | 847 | |
|
848 | 848 | or operator should preserve ordering: |
|
849 | 849 | $ log 'reverse(2::4) or tip' |
|
850 | 850 | 4 |
|
851 | 851 | 2 |
|
852 | 852 | 9 |
|
853 | 853 | |
|
854 | 854 | parentrevspec |
|
855 | 855 | |
|
856 | 856 | $ log 'merge()^0' |
|
857 | 857 | 6 |
|
858 | 858 | $ log 'merge()^' |
|
859 | 859 | 5 |
|
860 | 860 | $ log 'merge()^1' |
|
861 | 861 | 5 |
|
862 | 862 | $ log 'merge()^2' |
|
863 | 863 | 4 |
|
864 | 864 | $ log 'merge()^^' |
|
865 | 865 | 3 |
|
866 | 866 | $ log 'merge()^1^' |
|
867 | 867 | 3 |
|
868 | 868 | $ log 'merge()^^^' |
|
869 | 869 | 1 |
|
870 | 870 | |
|
871 | 871 | $ log 'merge()~0' |
|
872 | 872 | 6 |
|
873 | 873 | $ log 'merge()~1' |
|
874 | 874 | 5 |
|
875 | 875 | $ log 'merge()~2' |
|
876 | 876 | 3 |
|
877 | 877 | $ log 'merge()~2^1' |
|
878 | 878 | 1 |
|
879 | 879 | $ log 'merge()~3' |
|
880 | 880 | 1 |
|
881 | 881 | |
|
882 | 882 | $ log '(-3:tip)^' |
|
883 | 883 | 4 |
|
884 | 884 | 6 |
|
885 | 885 | 8 |
|
886 | 886 | |
|
887 | 887 | $ log 'tip^foo' |
|
888 | 888 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
889 | 889 | [255] |
|
890 | 890 | |
|
891 | Bogus function gets suggestions | |
|
892 | $ log 'add()' | |
|
893 | hg: parse error: not a function: add | |
|
894 | [255] | |
|
895 | $ log 'added()' | |
|
896 | hg: parse error: not a function: added | |
|
897 | [255] | |
|
898 | $ log 'remo()' | |
|
899 | hg: parse error: not a function: remo | |
|
900 | [255] | |
|
901 | $ log 'babar()' | |
|
902 | hg: parse error: not a function: babar | |
|
903 | [255] | |
|
904 | ||
|
891 | 905 | multiple revspecs |
|
892 | 906 | |
|
893 | 907 | $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' |
|
894 | 908 | 8 |
|
895 | 909 | 9 |
|
896 | 910 | 4 |
|
897 | 911 | 5 |
|
898 | 912 | 6 |
|
899 | 913 | 7 |
|
900 | 914 | |
|
901 | 915 | test usage in revpair (with "+") |
|
902 | 916 | |
|
903 | 917 | (real pair) |
|
904 | 918 | |
|
905 | 919 | $ hg diff -r 'tip^^' -r 'tip' |
|
906 | 920 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
907 | 921 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
908 | 922 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
909 | 923 | @@ -0,0 +1,1 @@ |
|
910 | 924 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
911 | 925 | $ hg diff -r 'tip^^::tip' |
|
912 | 926 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
913 | 927 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
914 | 928 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
915 | 929 | @@ -0,0 +1,1 @@ |
|
916 | 930 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
917 | 931 | |
|
918 | 932 | (single rev) |
|
919 | 933 | |
|
920 | 934 | $ hg diff -r 'tip^' -r 'tip^' |
|
921 | 935 | $ hg diff -r 'tip^::tip^ or tip^' |
|
922 | 936 | |
|
923 | 937 | (single rev that does not looks like a range) |
|
924 | 938 | |
|
925 | 939 | $ hg diff -r 'tip^ or tip^' |
|
926 | 940 | diff -r d5d0dcbdc4d9 .hgtags |
|
927 | 941 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
928 | 942 | +++ b/.hgtags * (glob) |
|
929 | 943 | @@ -0,0 +1,1 @@ |
|
930 | 944 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
931 | 945 | |
|
932 | 946 | (no rev) |
|
933 | 947 | |
|
934 | 948 | $ hg diff -r 'author("babar") or author("celeste")' |
|
935 | 949 | abort: empty revision range |
|
936 | 950 | [255] |
|
937 | 951 | |
|
938 | 952 | aliases: |
|
939 | 953 | |
|
940 | 954 | $ echo '[revsetalias]' >> .hg/hgrc |
|
941 | 955 | $ echo 'm = merge()' >> .hg/hgrc |
|
942 | 956 | $ echo 'sincem = descendants(m)' >> .hg/hgrc |
|
943 | 957 | $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc |
|
944 | 958 | $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
945 | 959 | $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
946 | 960 | |
|
947 | 961 | $ try m |
|
948 | 962 | ('symbol', 'm') |
|
949 | 963 | (func |
|
950 | 964 | ('symbol', 'merge') |
|
951 | 965 | None) |
|
952 | 966 | 6 |
|
953 | 967 | |
|
954 | 968 | test alias recursion |
|
955 | 969 | |
|
956 | 970 | $ try sincem |
|
957 | 971 | ('symbol', 'sincem') |
|
958 | 972 | (func |
|
959 | 973 | ('symbol', 'descendants') |
|
960 | 974 | (func |
|
961 | 975 | ('symbol', 'merge') |
|
962 | 976 | None)) |
|
963 | 977 | 6 |
|
964 | 978 | 7 |
|
965 | 979 | |
|
966 | 980 | test infinite recursion |
|
967 | 981 | |
|
968 | 982 | $ echo 'recurse1 = recurse2' >> .hg/hgrc |
|
969 | 983 | $ echo 'recurse2 = recurse1' >> .hg/hgrc |
|
970 | 984 | $ try recurse1 |
|
971 | 985 | ('symbol', 'recurse1') |
|
972 | 986 | hg: parse error: infinite expansion of revset alias "recurse1" detected |
|
973 | 987 | [255] |
|
974 | 988 | |
|
975 | 989 | $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc |
|
976 | 990 | $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc |
|
977 | 991 | $ try "level2(level1(1, 2), 3)" |
|
978 | 992 | (func |
|
979 | 993 | ('symbol', 'level2') |
|
980 | 994 | (list |
|
981 | 995 | (func |
|
982 | 996 | ('symbol', 'level1') |
|
983 | 997 | (list |
|
984 | 998 | ('symbol', '1') |
|
985 | 999 | ('symbol', '2'))) |
|
986 | 1000 | ('symbol', '3'))) |
|
987 | 1001 | (or |
|
988 | 1002 | ('symbol', '3') |
|
989 | 1003 | (or |
|
990 | 1004 | ('symbol', '1') |
|
991 | 1005 | ('symbol', '2'))) |
|
992 | 1006 | 3 |
|
993 | 1007 | 1 |
|
994 | 1008 | 2 |
|
995 | 1009 | |
|
996 | 1010 | test nesting and variable passing |
|
997 | 1011 | |
|
998 | 1012 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc |
|
999 | 1013 | $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc |
|
1000 | 1014 | $ echo 'nested3($1) = max($1)' >> .hg/hgrc |
|
1001 | 1015 | $ try 'nested(2:5)' |
|
1002 | 1016 | (func |
|
1003 | 1017 | ('symbol', 'nested') |
|
1004 | 1018 | (range |
|
1005 | 1019 | ('symbol', '2') |
|
1006 | 1020 | ('symbol', '5'))) |
|
1007 | 1021 | (func |
|
1008 | 1022 | ('symbol', 'max') |
|
1009 | 1023 | (range |
|
1010 | 1024 | ('symbol', '2') |
|
1011 | 1025 | ('symbol', '5'))) |
|
1012 | 1026 | 5 |
|
1013 | 1027 | |
|
1014 | 1028 | test variable isolation, variable placeholders are rewritten as string |
|
1015 | 1029 | then parsed and matched again as string. Check they do not leak too |
|
1016 | 1030 | far away. |
|
1017 | 1031 | |
|
1018 | 1032 | $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc |
|
1019 | 1033 | $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc |
|
1020 | 1034 | $ try 'callinjection(2:5)' |
|
1021 | 1035 | (func |
|
1022 | 1036 | ('symbol', 'callinjection') |
|
1023 | 1037 | (range |
|
1024 | 1038 | ('symbol', '2') |
|
1025 | 1039 | ('symbol', '5'))) |
|
1026 | 1040 | (func |
|
1027 | 1041 | ('symbol', 'descendants') |
|
1028 | 1042 | (func |
|
1029 | 1043 | ('symbol', 'max') |
|
1030 | 1044 | ('string', '$1'))) |
|
1031 | 1045 | abort: unknown revision '$1'! |
|
1032 | 1046 | [255] |
|
1033 | 1047 | |
|
1034 | 1048 | $ echo 'injectparamasstring2 = max(_aliasarg("$1"))' >> .hg/hgrc |
|
1035 | 1049 | $ echo 'callinjection2($1) = descendants(injectparamasstring2)' >> .hg/hgrc |
|
1036 | 1050 | $ try 'callinjection2(2:5)' |
|
1037 | 1051 | (func |
|
1038 | 1052 | ('symbol', 'callinjection2') |
|
1039 | 1053 | (range |
|
1040 | 1054 | ('symbol', '2') |
|
1041 | 1055 | ('symbol', '5'))) |
|
1042 | 1056 | abort: failed to parse the definition of revset alias "injectparamasstring2": not a function: _aliasarg |
|
1043 | 1057 | [255] |
|
1044 | 1058 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" |
|
1045 | 1059 | ('symbol', 'tip') |
|
1046 | 1060 | warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end |
|
1047 | 1061 | warning: failed to parse the definition of revset alias "injectparamasstring2": not a function: _aliasarg |
|
1048 | 1062 | 9 |
|
1049 | 1063 | >>> data = file('.hg/hgrc', 'rb').read() |
|
1050 | 1064 | >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', '')) |
|
1051 | 1065 | |
|
1052 | 1066 | $ try 'tip' |
|
1053 | 1067 | ('symbol', 'tip') |
|
1054 | 1068 | 9 |
|
1055 | 1069 | |
|
1056 | 1070 | $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" |
|
1057 | 1071 | ('symbol', 'tip') |
|
1058 | 1072 | warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token |
|
1059 | 1073 | 9 |
|
1060 | 1074 | $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc |
|
1061 | 1075 | $ try 'strictreplacing("foo", tip)' |
|
1062 | 1076 | (func |
|
1063 | 1077 | ('symbol', 'strictreplacing') |
|
1064 | 1078 | (list |
|
1065 | 1079 | ('string', 'foo') |
|
1066 | 1080 | ('symbol', 'tip'))) |
|
1067 | 1081 | (or |
|
1068 | 1082 | ('symbol', 'tip') |
|
1069 | 1083 | (func |
|
1070 | 1084 | ('symbol', 'desc') |
|
1071 | 1085 | ('string', '$1'))) |
|
1072 | 1086 | 9 |
|
1073 | 1087 | |
|
1074 | 1088 | $ try 'd(2:5)' |
|
1075 | 1089 | (func |
|
1076 | 1090 | ('symbol', 'd') |
|
1077 | 1091 | (range |
|
1078 | 1092 | ('symbol', '2') |
|
1079 | 1093 | ('symbol', '5'))) |
|
1080 | 1094 | (func |
|
1081 | 1095 | ('symbol', 'reverse') |
|
1082 | 1096 | (func |
|
1083 | 1097 | ('symbol', 'sort') |
|
1084 | 1098 | (list |
|
1085 | 1099 | (range |
|
1086 | 1100 | ('symbol', '2') |
|
1087 | 1101 | ('symbol', '5')) |
|
1088 | 1102 | ('symbol', 'date')))) |
|
1089 | 1103 | 4 |
|
1090 | 1104 | 5 |
|
1091 | 1105 | 3 |
|
1092 | 1106 | 2 |
|
1093 | 1107 | $ try 'rs(2 or 3, date)' |
|
1094 | 1108 | (func |
|
1095 | 1109 | ('symbol', 'rs') |
|
1096 | 1110 | (list |
|
1097 | 1111 | (or |
|
1098 | 1112 | ('symbol', '2') |
|
1099 | 1113 | ('symbol', '3')) |
|
1100 | 1114 | ('symbol', 'date'))) |
|
1101 | 1115 | (func |
|
1102 | 1116 | ('symbol', 'reverse') |
|
1103 | 1117 | (func |
|
1104 | 1118 | ('symbol', 'sort') |
|
1105 | 1119 | (list |
|
1106 | 1120 | (or |
|
1107 | 1121 | ('symbol', '2') |
|
1108 | 1122 | ('symbol', '3')) |
|
1109 | 1123 | ('symbol', 'date')))) |
|
1110 | 1124 | 3 |
|
1111 | 1125 | 2 |
|
1112 | 1126 | $ try 'rs()' |
|
1113 | 1127 | (func |
|
1114 | 1128 | ('symbol', 'rs') |
|
1115 | 1129 | None) |
|
1116 | 1130 | hg: parse error: invalid number of arguments: 0 |
|
1117 | 1131 | [255] |
|
1118 | 1132 | $ try 'rs(2)' |
|
1119 | 1133 | (func |
|
1120 | 1134 | ('symbol', 'rs') |
|
1121 | 1135 | ('symbol', '2')) |
|
1122 | 1136 | hg: parse error: invalid number of arguments: 1 |
|
1123 | 1137 | [255] |
|
1124 | 1138 | $ try 'rs(2, data, 7)' |
|
1125 | 1139 | (func |
|
1126 | 1140 | ('symbol', 'rs') |
|
1127 | 1141 | (list |
|
1128 | 1142 | (list |
|
1129 | 1143 | ('symbol', '2') |
|
1130 | 1144 | ('symbol', 'data')) |
|
1131 | 1145 | ('symbol', '7'))) |
|
1132 | 1146 | hg: parse error: invalid number of arguments: 3 |
|
1133 | 1147 | [255] |
|
1134 | 1148 | $ try 'rs4(2 or 3, x, x, date)' |
|
1135 | 1149 | (func |
|
1136 | 1150 | ('symbol', 'rs4') |
|
1137 | 1151 | (list |
|
1138 | 1152 | (list |
|
1139 | 1153 | (list |
|
1140 | 1154 | (or |
|
1141 | 1155 | ('symbol', '2') |
|
1142 | 1156 | ('symbol', '3')) |
|
1143 | 1157 | ('symbol', 'x')) |
|
1144 | 1158 | ('symbol', 'x')) |
|
1145 | 1159 | ('symbol', 'date'))) |
|
1146 | 1160 | (func |
|
1147 | 1161 | ('symbol', 'reverse') |
|
1148 | 1162 | (func |
|
1149 | 1163 | ('symbol', 'sort') |
|
1150 | 1164 | (list |
|
1151 | 1165 | (or |
|
1152 | 1166 | ('symbol', '2') |
|
1153 | 1167 | ('symbol', '3')) |
|
1154 | 1168 | ('symbol', 'date')))) |
|
1155 | 1169 | 3 |
|
1156 | 1170 | 2 |
|
1157 | 1171 | |
|
1158 | 1172 | issue4553: check that revset aliases override existing hash prefix |
|
1159 | 1173 | |
|
1160 | 1174 | $ hg log -qr e |
|
1161 | 1175 | 6:e0cc66ef77e8 |
|
1162 | 1176 | |
|
1163 | 1177 | $ hg log -qr e --config revsetalias.e="all()" |
|
1164 | 1178 | 0:2785f51eece5 |
|
1165 | 1179 | 1:d75937da8da0 |
|
1166 | 1180 | 2:5ed5505e9f1c |
|
1167 | 1181 | 3:8528aa5637f2 |
|
1168 | 1182 | 4:2326846efdab |
|
1169 | 1183 | 5:904fa392b941 |
|
1170 | 1184 | 6:e0cc66ef77e8 |
|
1171 | 1185 | 7:013af1973af4 |
|
1172 | 1186 | 8:d5d0dcbdc4d9 |
|
1173 | 1187 | 9:24286f4ae135 |
|
1174 | 1188 | |
|
1175 | 1189 | $ hg log -qr e: --config revsetalias.e="0" |
|
1176 | 1190 | 0:2785f51eece5 |
|
1177 | 1191 | 1:d75937da8da0 |
|
1178 | 1192 | 2:5ed5505e9f1c |
|
1179 | 1193 | 3:8528aa5637f2 |
|
1180 | 1194 | 4:2326846efdab |
|
1181 | 1195 | 5:904fa392b941 |
|
1182 | 1196 | 6:e0cc66ef77e8 |
|
1183 | 1197 | 7:013af1973af4 |
|
1184 | 1198 | 8:d5d0dcbdc4d9 |
|
1185 | 1199 | 9:24286f4ae135 |
|
1186 | 1200 | |
|
1187 | 1201 | $ hg log -qr :e --config revsetalias.e="9" |
|
1188 | 1202 | 0:2785f51eece5 |
|
1189 | 1203 | 1:d75937da8da0 |
|
1190 | 1204 | 2:5ed5505e9f1c |
|
1191 | 1205 | 3:8528aa5637f2 |
|
1192 | 1206 | 4:2326846efdab |
|
1193 | 1207 | 5:904fa392b941 |
|
1194 | 1208 | 6:e0cc66ef77e8 |
|
1195 | 1209 | 7:013af1973af4 |
|
1196 | 1210 | 8:d5d0dcbdc4d9 |
|
1197 | 1211 | 9:24286f4ae135 |
|
1198 | 1212 | |
|
1199 | 1213 | $ hg log -qr e: |
|
1200 | 1214 | 6:e0cc66ef77e8 |
|
1201 | 1215 | 7:013af1973af4 |
|
1202 | 1216 | 8:d5d0dcbdc4d9 |
|
1203 | 1217 | 9:24286f4ae135 |
|
1204 | 1218 | |
|
1205 | 1219 | $ hg log -qr :e |
|
1206 | 1220 | 0:2785f51eece5 |
|
1207 | 1221 | 1:d75937da8da0 |
|
1208 | 1222 | 2:5ed5505e9f1c |
|
1209 | 1223 | 3:8528aa5637f2 |
|
1210 | 1224 | 4:2326846efdab |
|
1211 | 1225 | 5:904fa392b941 |
|
1212 | 1226 | 6:e0cc66ef77e8 |
|
1213 | 1227 | |
|
1214 | 1228 | issue2549 - correct optimizations |
|
1215 | 1229 | |
|
1216 | 1230 | $ log 'limit(1 or 2 or 3, 2) and not 2' |
|
1217 | 1231 | 1 |
|
1218 | 1232 | $ log 'max(1 or 2) and not 2' |
|
1219 | 1233 | $ log 'min(1 or 2) and not 1' |
|
1220 | 1234 | $ log 'last(1 or 2, 1) and not 2' |
|
1221 | 1235 | |
|
1222 | 1236 | issue4289 - ordering of built-ins |
|
1223 | 1237 | $ hg log -M -q -r 3:2 |
|
1224 | 1238 | 3:8528aa5637f2 |
|
1225 | 1239 | 2:5ed5505e9f1c |
|
1226 | 1240 | |
|
1227 | 1241 | test revsets started with 40-chars hash (issue3669) |
|
1228 | 1242 | |
|
1229 | 1243 | $ ISSUE3669_TIP=`hg tip --template '{node}'` |
|
1230 | 1244 | $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n' |
|
1231 | 1245 | 9 |
|
1232 | 1246 | $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n' |
|
1233 | 1247 | 8 |
|
1234 | 1248 | |
|
1235 | 1249 | test or-ed indirect predicates (issue3775) |
|
1236 | 1250 | |
|
1237 | 1251 | $ log '6 or 6^1' | sort |
|
1238 | 1252 | 5 |
|
1239 | 1253 | 6 |
|
1240 | 1254 | $ log '6^1 or 6' | sort |
|
1241 | 1255 | 5 |
|
1242 | 1256 | 6 |
|
1243 | 1257 | $ log '4 or 4~1' | sort |
|
1244 | 1258 | 2 |
|
1245 | 1259 | 4 |
|
1246 | 1260 | $ log '4~1 or 4' | sort |
|
1247 | 1261 | 2 |
|
1248 | 1262 | 4 |
|
1249 | 1263 | $ log '(0 or 2):(4 or 6) or 0 or 6' | sort |
|
1250 | 1264 | 0 |
|
1251 | 1265 | 1 |
|
1252 | 1266 | 2 |
|
1253 | 1267 | 3 |
|
1254 | 1268 | 4 |
|
1255 | 1269 | 5 |
|
1256 | 1270 | 6 |
|
1257 | 1271 | $ log '0 or 6 or (0 or 2):(4 or 6)' | sort |
|
1258 | 1272 | 0 |
|
1259 | 1273 | 1 |
|
1260 | 1274 | 2 |
|
1261 | 1275 | 3 |
|
1262 | 1276 | 4 |
|
1263 | 1277 | 5 |
|
1264 | 1278 | 6 |
|
1265 | 1279 | |
|
1266 | 1280 | tests for 'remote()' predicate: |
|
1267 | 1281 | #. (csets in remote) (id) (remote) |
|
1268 | 1282 | 1. less than local current branch "default" |
|
1269 | 1283 | 2. same with local specified "default" |
|
1270 | 1284 | 3. more than local specified specified |
|
1271 | 1285 | |
|
1272 | 1286 | $ hg clone --quiet -U . ../remote3 |
|
1273 | 1287 | $ cd ../remote3 |
|
1274 | 1288 | $ hg update -q 7 |
|
1275 | 1289 | $ echo r > r |
|
1276 | 1290 | $ hg ci -Aqm 10 |
|
1277 | 1291 | $ log 'remote()' |
|
1278 | 1292 | 7 |
|
1279 | 1293 | $ log 'remote("a-b-c-")' |
|
1280 | 1294 | 2 |
|
1281 | 1295 | $ cd ../repo |
|
1282 | 1296 | $ log 'remote(".a.b.c.", "../remote3")' |
|
1283 | 1297 | |
|
1284 | 1298 | tests for concatenation of strings/symbols by "##" |
|
1285 | 1299 | |
|
1286 | 1300 | $ try "278 ## '5f5' ## 1ee ## 'ce5'" |
|
1287 | 1301 | (_concat |
|
1288 | 1302 | (_concat |
|
1289 | 1303 | (_concat |
|
1290 | 1304 | ('symbol', '278') |
|
1291 | 1305 | ('string', '5f5')) |
|
1292 | 1306 | ('symbol', '1ee')) |
|
1293 | 1307 | ('string', 'ce5')) |
|
1294 | 1308 | ('string', '2785f51eece5') |
|
1295 | 1309 | 0 |
|
1296 | 1310 | |
|
1297 | 1311 | $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc |
|
1298 | 1312 | $ try "cat4(278, '5f5', 1ee, 'ce5')" |
|
1299 | 1313 | (func |
|
1300 | 1314 | ('symbol', 'cat4') |
|
1301 | 1315 | (list |
|
1302 | 1316 | (list |
|
1303 | 1317 | (list |
|
1304 | 1318 | ('symbol', '278') |
|
1305 | 1319 | ('string', '5f5')) |
|
1306 | 1320 | ('symbol', '1ee')) |
|
1307 | 1321 | ('string', 'ce5'))) |
|
1308 | 1322 | (_concat |
|
1309 | 1323 | (_concat |
|
1310 | 1324 | (_concat |
|
1311 | 1325 | ('symbol', '278') |
|
1312 | 1326 | ('string', '5f5')) |
|
1313 | 1327 | ('symbol', '1ee')) |
|
1314 | 1328 | ('string', 'ce5')) |
|
1315 | 1329 | ('string', '2785f51eece5') |
|
1316 | 1330 | 0 |
|
1317 | 1331 | |
|
1318 | 1332 | (check concatenation in alias nesting) |
|
1319 | 1333 | |
|
1320 | 1334 | $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc |
|
1321 | 1335 | $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc |
|
1322 | 1336 | $ log "cat2x2(278, '5f5', 1ee, 'ce5')" |
|
1323 | 1337 | 0 |
|
1324 | 1338 | |
|
1325 | 1339 | (check operator priority) |
|
1326 | 1340 | |
|
1327 | 1341 | $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc |
|
1328 | 1342 | $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)" |
|
1329 | 1343 | 0 |
|
1330 | 1344 | 4 |
|
1331 | 1345 | |
|
1332 | 1346 | $ cd .. |
|
1333 | 1347 | |
|
1334 | 1348 | test author/desc/keyword in problematic encoding |
|
1335 | 1349 | # unicode: cp932: |
|
1336 | 1350 | # u30A2 0x83 0x41(= 'A') |
|
1337 | 1351 | # u30C2 0x83 0x61(= 'a') |
|
1338 | 1352 | |
|
1339 | 1353 | $ hg init problematicencoding |
|
1340 | 1354 | $ cd problematicencoding |
|
1341 | 1355 | |
|
1342 | 1356 | $ python > setup.sh <<EOF |
|
1343 | 1357 | > print u''' |
|
1344 | 1358 | > echo a > text |
|
1345 | 1359 | > hg add text |
|
1346 | 1360 | > hg --encoding utf-8 commit -u '\u30A2' -m none |
|
1347 | 1361 | > echo b > text |
|
1348 | 1362 | > hg --encoding utf-8 commit -u '\u30C2' -m none |
|
1349 | 1363 | > echo c > text |
|
1350 | 1364 | > hg --encoding utf-8 commit -u none -m '\u30A2' |
|
1351 | 1365 | > echo d > text |
|
1352 | 1366 | > hg --encoding utf-8 commit -u none -m '\u30C2' |
|
1353 | 1367 | > '''.encode('utf-8') |
|
1354 | 1368 | > EOF |
|
1355 | 1369 | $ sh < setup.sh |
|
1356 | 1370 | |
|
1357 | 1371 | test in problematic encoding |
|
1358 | 1372 | $ python > test.sh <<EOF |
|
1359 | 1373 | > print u''' |
|
1360 | 1374 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)' |
|
1361 | 1375 | > echo ==== |
|
1362 | 1376 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)' |
|
1363 | 1377 | > echo ==== |
|
1364 | 1378 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)' |
|
1365 | 1379 | > echo ==== |
|
1366 | 1380 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)' |
|
1367 | 1381 | > echo ==== |
|
1368 | 1382 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)' |
|
1369 | 1383 | > echo ==== |
|
1370 | 1384 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)' |
|
1371 | 1385 | > '''.encode('cp932') |
|
1372 | 1386 | > EOF |
|
1373 | 1387 | $ sh < test.sh |
|
1374 | 1388 | 0 |
|
1375 | 1389 | ==== |
|
1376 | 1390 | 1 |
|
1377 | 1391 | ==== |
|
1378 | 1392 | 2 |
|
1379 | 1393 | ==== |
|
1380 | 1394 | 3 |
|
1381 | 1395 | ==== |
|
1382 | 1396 | 0 |
|
1383 | 1397 | 2 |
|
1384 | 1398 | ==== |
|
1385 | 1399 | 1 |
|
1386 | 1400 | 3 |
|
1387 | 1401 | |
|
1388 | 1402 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now