Show More
@@ -840,11 +840,6 b' def shortest(context, mapping, args):' | |||
|
840 | 840 | cl = mapping['ctx']._repo.changelog |
|
841 | 841 | def isvalid(test): |
|
842 | 842 | try: |
|
843 | try: | |
|
844 | cl.index.partialmatch(test) | |
|
845 | except AttributeError: | |
|
846 | # Pure mercurial doesn't support partialmatch on the index. | |
|
847 | # Fallback to the slow way. | |
|
848 | 843 |
|
|
849 | 844 |
|
|
850 | 845 |
@@ -3413,8 +3413,76 b' Test shortest(node) function:' | |||
|
3413 | 3413 | hg: parse error: shortest() expects an integer minlength |
|
3414 | 3414 | [255] |
|
3415 | 3415 | |
|
3416 | $ cd .. | |
|
3417 | ||
|
3418 | Test shortest(node) with the repo having short hash collision: | |
|
3419 | ||
|
3420 | $ hg init hashcollision | |
|
3421 | $ cd hashcollision | |
|
3422 | $ cat <<EOF >> .hg/hgrc | |
|
3423 | > [experimental] | |
|
3424 | > evolution = createmarkers | |
|
3425 | > EOF | |
|
3426 | $ echo 0 > a | |
|
3427 | $ hg ci -qAm 0 | |
|
3428 | $ for i in 17 129 248 242 480 580 617 1057 2857 4025; do | |
|
3429 | > hg up -q 0 | |
|
3430 | > echo $i > a | |
|
3431 | > hg ci -qm $i | |
|
3432 | > done | |
|
3433 | $ hg up -q null | |
|
3434 | $ hg log -r0: -T '{rev}:{node}\n' | |
|
3435 | 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a | |
|
3436 | 1:11424df6dc1dd4ea255eae2b58eaca7831973bbc | |
|
3437 | 2:11407b3f1b9c3e76a79c1ec5373924df096f0499 | |
|
3438 | 3:11dd92fe0f39dfdaacdaa5f3997edc533875cfc4 | |
|
3439 | 4:10776689e627b465361ad5c296a20a487e153ca4 | |
|
3440 | 5:a00be79088084cb3aff086ab799f8790e01a976b | |
|
3441 | 6:a0b0acd79b4498d0052993d35a6a748dd51d13e6 | |
|
3442 | 7:a0457b3450b8e1b778f1163b31a435802987fe5d | |
|
3443 | 8:c56256a09cd28e5764f32e8e2810d0f01e2e357a | |
|
3444 | 9:c5623987d205cd6d9d8389bfc40fff9dbb670b48 | |
|
3445 | 10:c562ddd9c94164376c20b86b0b4991636a3bf84f | |
|
3446 | $ hg debugobsolete a00be79088084cb3aff086ab799f8790e01a976b | |
|
3447 | $ hg debugobsolete c5623987d205cd6d9d8389bfc40fff9dbb670b48 | |
|
3448 | $ hg debugobsolete c562ddd9c94164376c20b86b0b4991636a3bf84f | |
|
3449 | ||
|
3450 | nodes starting with '11' (we don't have the revision number '11' though) | |
|
3451 | ||
|
3452 | $ hg log -r 1:3 -T '{rev}:{shortest(node, 0)}\n' | |
|
3453 | 1:1142 | |
|
3454 | 2:1140 | |
|
3455 | 3:11d | |
|
3456 | ||
|
3457 | '5:a00' is hidden, but still we have two nodes starting with 'a0' | |
|
3458 | ||
|
3459 | $ hg log -r 6:7 -T '{rev}:{shortest(node, 0)}\n' | |
|
3460 | 6:a0b | |
|
3461 | 7:a04 | |
|
3462 | ||
|
3463 | node '10' conflicts with the revision number '10' even if it is hidden | |
|
3464 | (we could exclude hidden revision numbers, but currently we don't) | |
|
3465 | ||
|
3466 | $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' | |
|
3467 | 4:107 | |
|
3468 | $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden | |
|
3469 | 4:107 | |
|
3470 | ||
|
3471 | node 'c562' should be unique if the other 'c562' nodes are hidden | |
|
3472 | ||
|
3473 | $ hg log -r 8 -T '{rev}:{node|shortest}\n' | |
|
3474 | 8:c562 | |
|
3475 | $ hg log -r 8:10 -T '{rev}:{node|shortest}\n' --hidden | |
|
3476 | 8:c5625 | |
|
3477 | 9:c5623 | |
|
3478 | 10:c562d | |
|
3479 | ||
|
3480 | $ cd .. | |
|
3481 | ||
|
3416 | 3482 | Test pad function |
|
3417 | 3483 | |
|
3484 | $ cd r | |
|
3485 | ||
|
3418 | 3486 | $ hg log --template '{pad(rev, 20)} {author|user}\n' |
|
3419 | 3487 | 2 test |
|
3420 | 3488 | 1 {node|short} |
General Comments 0
You need to be logged in to leave comments.
Login now