Show More
@@ -490,6 +490,7 b' test-symlinks.t' | |||
|
490 | 490 | test-tag.t |
|
491 | 491 | test-tags.t |
|
492 | 492 | test-template-functions.t |
|
493 | test-template-keywords.t | |
|
493 | 494 | test-template-map.t |
|
494 | 495 | test-transplant.t |
|
495 | 496 | test-treemanifest.t |
This diff has been collapsed as it changes many lines, (1079 lines changed) Show them Hide them | |||
@@ -210,18 +210,6 b' Second branch starting at nullrev:' | |||
|
210 | 210 | 8 t |
|
211 | 211 | 7 f |
|
212 | 212 | |
|
213 | Working-directory revision has special identifiers, though they are still | |
|
214 | experimental: | |
|
215 | ||
|
216 | $ hg log -r 'wdir()' -T '{rev}:{node}\n' | |
|
217 | 2147483647:ffffffffffffffffffffffffffffffffffffffff | |
|
218 | ||
|
219 | Some keywords are invalid for working-directory revision, but they should | |
|
220 | never cause crash: | |
|
221 | ||
|
222 | $ hg log -r 'wdir()' -T '{manifest}\n' | |
|
223 | ||
|
224 | ||
|
225 | 213 | Internal resources shouldn't be exposed (issue5699): |
|
226 | 214 | |
|
227 | 215 | $ hg log -r. -T '{cache}{ctx}{repo}{revcache}{templ}{ui}' |
@@ -284,650 +272,10 b' Check that recursive reference does not ' | |||
|
284 | 272 | $ hg log --style ./issue4758 -r tip |
|
285 | 273 | 8 tip |
|
286 | 274 | |
|
287 | Check that {phase} works correctly on parents: | |
|
275 | Set up phase: | |
|
288 | 276 | |
|
289 | $ cat << EOF > parentphase | |
|
290 | > changeset_debug = '{rev} ({phase}):{parents}\n' | |
|
291 | > parent = ' {rev} ({phase})' | |
|
292 | > EOF | |
|
293 | 277 | $ hg phase -r 5 --public |
|
294 | 278 | $ hg phase -r 7 --secret --force |
|
295 | $ hg log --debug -G --style ./parentphase | |
|
296 | @ 8 (secret): 7 (secret) -1 (public) | |
|
297 | | | |
|
298 | o 7 (secret): -1 (public) -1 (public) | |
|
299 | ||
|
300 | o 6 (draft): 5 (public) 4 (draft) | |
|
301 | |\ | |
|
302 | | o 5 (public): 3 (public) -1 (public) | |
|
303 | | | | |
|
304 | o | 4 (draft): 3 (public) -1 (public) | |
|
305 | |/ | |
|
306 | o 3 (public): 2 (public) -1 (public) | |
|
307 | | | |
|
308 | o 2 (public): 1 (public) -1 (public) | |
|
309 | | | |
|
310 | o 1 (public): 0 (public) -1 (public) | |
|
311 | | | |
|
312 | o 0 (public): -1 (public) -1 (public) | |
|
313 | ||
|
314 | ||
|
315 | Keys work: | |
|
316 | ||
|
317 | $ for key in author branch branches date desc file_adds file_dels file_mods \ | |
|
318 | > file_copies file_copies_switch files \ | |
|
319 | > manifest node parents rev tags diffstat extras \ | |
|
320 | > p1rev p2rev p1node p2node; do | |
|
321 | > for mode in '' --verbose --debug; do | |
|
322 | > hg log $mode --template "$key$mode: {$key}\n" | |
|
323 | > done | |
|
324 | > done | |
|
325 | author: test | |
|
326 | author: User Name <user@hostname> | |
|
327 | author: person | |
|
328 | author: person | |
|
329 | author: person | |
|
330 | author: person | |
|
331 | author: other@place | |
|
332 | author: A. N. Other <other@place> | |
|
333 | author: User Name <user@hostname> | |
|
334 | author--verbose: test | |
|
335 | author--verbose: User Name <user@hostname> | |
|
336 | author--verbose: person | |
|
337 | author--verbose: person | |
|
338 | author--verbose: person | |
|
339 | author--verbose: person | |
|
340 | author--verbose: other@place | |
|
341 | author--verbose: A. N. Other <other@place> | |
|
342 | author--verbose: User Name <user@hostname> | |
|
343 | author--debug: test | |
|
344 | author--debug: User Name <user@hostname> | |
|
345 | author--debug: person | |
|
346 | author--debug: person | |
|
347 | author--debug: person | |
|
348 | author--debug: person | |
|
349 | author--debug: other@place | |
|
350 | author--debug: A. N. Other <other@place> | |
|
351 | author--debug: User Name <user@hostname> | |
|
352 | branch: default | |
|
353 | branch: default | |
|
354 | branch: default | |
|
355 | branch: default | |
|
356 | branch: foo | |
|
357 | branch: default | |
|
358 | branch: default | |
|
359 | branch: default | |
|
360 | branch: default | |
|
361 | branch--verbose: default | |
|
362 | branch--verbose: default | |
|
363 | branch--verbose: default | |
|
364 | branch--verbose: default | |
|
365 | branch--verbose: foo | |
|
366 | branch--verbose: default | |
|
367 | branch--verbose: default | |
|
368 | branch--verbose: default | |
|
369 | branch--verbose: default | |
|
370 | branch--debug: default | |
|
371 | branch--debug: default | |
|
372 | branch--debug: default | |
|
373 | branch--debug: default | |
|
374 | branch--debug: foo | |
|
375 | branch--debug: default | |
|
376 | branch--debug: default | |
|
377 | branch--debug: default | |
|
378 | branch--debug: default | |
|
379 | branches: | |
|
380 | branches: | |
|
381 | branches: | |
|
382 | branches: | |
|
383 | branches: foo | |
|
384 | branches: | |
|
385 | branches: | |
|
386 | branches: | |
|
387 | branches: | |
|
388 | branches--verbose: | |
|
389 | branches--verbose: | |
|
390 | branches--verbose: | |
|
391 | branches--verbose: | |
|
392 | branches--verbose: foo | |
|
393 | branches--verbose: | |
|
394 | branches--verbose: | |
|
395 | branches--verbose: | |
|
396 | branches--verbose: | |
|
397 | branches--debug: | |
|
398 | branches--debug: | |
|
399 | branches--debug: | |
|
400 | branches--debug: | |
|
401 | branches--debug: foo | |
|
402 | branches--debug: | |
|
403 | branches--debug: | |
|
404 | branches--debug: | |
|
405 | branches--debug: | |
|
406 | date: 1577872860.00 | |
|
407 | date: 1000000.00 | |
|
408 | date: 1500001.00 | |
|
409 | date: 1500000.00 | |
|
410 | date: 1400000.00 | |
|
411 | date: 1300000.00 | |
|
412 | date: 1200000.00 | |
|
413 | date: 1100000.00 | |
|
414 | date: 1000000.00 | |
|
415 | date--verbose: 1577872860.00 | |
|
416 | date--verbose: 1000000.00 | |
|
417 | date--verbose: 1500001.00 | |
|
418 | date--verbose: 1500000.00 | |
|
419 | date--verbose: 1400000.00 | |
|
420 | date--verbose: 1300000.00 | |
|
421 | date--verbose: 1200000.00 | |
|
422 | date--verbose: 1100000.00 | |
|
423 | date--verbose: 1000000.00 | |
|
424 | date--debug: 1577872860.00 | |
|
425 | date--debug: 1000000.00 | |
|
426 | date--debug: 1500001.00 | |
|
427 | date--debug: 1500000.00 | |
|
428 | date--debug: 1400000.00 | |
|
429 | date--debug: 1300000.00 | |
|
430 | date--debug: 1200000.00 | |
|
431 | date--debug: 1100000.00 | |
|
432 | date--debug: 1000000.00 | |
|
433 | desc: third | |
|
434 | desc: second | |
|
435 | desc: merge | |
|
436 | desc: new head | |
|
437 | desc: new branch | |
|
438 | desc: no user, no domain | |
|
439 | desc: no person | |
|
440 | desc: other 1 | |
|
441 | other 2 | |
|
442 | ||
|
443 | other 3 | |
|
444 | desc: line 1 | |
|
445 | line 2 | |
|
446 | desc--verbose: third | |
|
447 | desc--verbose: second | |
|
448 | desc--verbose: merge | |
|
449 | desc--verbose: new head | |
|
450 | desc--verbose: new branch | |
|
451 | desc--verbose: no user, no domain | |
|
452 | desc--verbose: no person | |
|
453 | desc--verbose: other 1 | |
|
454 | other 2 | |
|
455 | ||
|
456 | other 3 | |
|
457 | desc--verbose: line 1 | |
|
458 | line 2 | |
|
459 | desc--debug: third | |
|
460 | desc--debug: second | |
|
461 | desc--debug: merge | |
|
462 | desc--debug: new head | |
|
463 | desc--debug: new branch | |
|
464 | desc--debug: no user, no domain | |
|
465 | desc--debug: no person | |
|
466 | desc--debug: other 1 | |
|
467 | other 2 | |
|
468 | ||
|
469 | other 3 | |
|
470 | desc--debug: line 1 | |
|
471 | line 2 | |
|
472 | file_adds: fourth third | |
|
473 | file_adds: second | |
|
474 | file_adds: | |
|
475 | file_adds: d | |
|
476 | file_adds: | |
|
477 | file_adds: | |
|
478 | file_adds: c | |
|
479 | file_adds: b | |
|
480 | file_adds: a | |
|
481 | file_adds--verbose: fourth third | |
|
482 | file_adds--verbose: second | |
|
483 | file_adds--verbose: | |
|
484 | file_adds--verbose: d | |
|
485 | file_adds--verbose: | |
|
486 | file_adds--verbose: | |
|
487 | file_adds--verbose: c | |
|
488 | file_adds--verbose: b | |
|
489 | file_adds--verbose: a | |
|
490 | file_adds--debug: fourth third | |
|
491 | file_adds--debug: second | |
|
492 | file_adds--debug: | |
|
493 | file_adds--debug: d | |
|
494 | file_adds--debug: | |
|
495 | file_adds--debug: | |
|
496 | file_adds--debug: c | |
|
497 | file_adds--debug: b | |
|
498 | file_adds--debug: a | |
|
499 | file_dels: second | |
|
500 | file_dels: | |
|
501 | file_dels: | |
|
502 | file_dels: | |
|
503 | file_dels: | |
|
504 | file_dels: | |
|
505 | file_dels: | |
|
506 | file_dels: | |
|
507 | file_dels: | |
|
508 | file_dels--verbose: second | |
|
509 | file_dels--verbose: | |
|
510 | file_dels--verbose: | |
|
511 | file_dels--verbose: | |
|
512 | file_dels--verbose: | |
|
513 | file_dels--verbose: | |
|
514 | file_dels--verbose: | |
|
515 | file_dels--verbose: | |
|
516 | file_dels--verbose: | |
|
517 | file_dels--debug: second | |
|
518 | file_dels--debug: | |
|
519 | file_dels--debug: | |
|
520 | file_dels--debug: | |
|
521 | file_dels--debug: | |
|
522 | file_dels--debug: | |
|
523 | file_dels--debug: | |
|
524 | file_dels--debug: | |
|
525 | file_dels--debug: | |
|
526 | file_mods: | |
|
527 | file_mods: | |
|
528 | file_mods: | |
|
529 | file_mods: | |
|
530 | file_mods: | |
|
531 | file_mods: c | |
|
532 | file_mods: | |
|
533 | file_mods: | |
|
534 | file_mods: | |
|
535 | file_mods--verbose: | |
|
536 | file_mods--verbose: | |
|
537 | file_mods--verbose: | |
|
538 | file_mods--verbose: | |
|
539 | file_mods--verbose: | |
|
540 | file_mods--verbose: c | |
|
541 | file_mods--verbose: | |
|
542 | file_mods--verbose: | |
|
543 | file_mods--verbose: | |
|
544 | file_mods--debug: | |
|
545 | file_mods--debug: | |
|
546 | file_mods--debug: | |
|
547 | file_mods--debug: | |
|
548 | file_mods--debug: | |
|
549 | file_mods--debug: c | |
|
550 | file_mods--debug: | |
|
551 | file_mods--debug: | |
|
552 | file_mods--debug: | |
|
553 | file_copies: fourth (second) | |
|
554 | file_copies: | |
|
555 | file_copies: | |
|
556 | file_copies: | |
|
557 | file_copies: | |
|
558 | file_copies: | |
|
559 | file_copies: | |
|
560 | file_copies: | |
|
561 | file_copies: | |
|
562 | file_copies--verbose: fourth (second) | |
|
563 | file_copies--verbose: | |
|
564 | file_copies--verbose: | |
|
565 | file_copies--verbose: | |
|
566 | file_copies--verbose: | |
|
567 | file_copies--verbose: | |
|
568 | file_copies--verbose: | |
|
569 | file_copies--verbose: | |
|
570 | file_copies--verbose: | |
|
571 | file_copies--debug: fourth (second) | |
|
572 | file_copies--debug: | |
|
573 | file_copies--debug: | |
|
574 | file_copies--debug: | |
|
575 | file_copies--debug: | |
|
576 | file_copies--debug: | |
|
577 | file_copies--debug: | |
|
578 | file_copies--debug: | |
|
579 | file_copies--debug: | |
|
580 | file_copies_switch: | |
|
581 | file_copies_switch: | |
|
582 | file_copies_switch: | |
|
583 | file_copies_switch: | |
|
584 | file_copies_switch: | |
|
585 | file_copies_switch: | |
|
586 | file_copies_switch: | |
|
587 | file_copies_switch: | |
|
588 | file_copies_switch: | |
|
589 | file_copies_switch--verbose: | |
|
590 | file_copies_switch--verbose: | |
|
591 | file_copies_switch--verbose: | |
|
592 | file_copies_switch--verbose: | |
|
593 | file_copies_switch--verbose: | |
|
594 | file_copies_switch--verbose: | |
|
595 | file_copies_switch--verbose: | |
|
596 | file_copies_switch--verbose: | |
|
597 | file_copies_switch--verbose: | |
|
598 | file_copies_switch--debug: | |
|
599 | file_copies_switch--debug: | |
|
600 | file_copies_switch--debug: | |
|
601 | file_copies_switch--debug: | |
|
602 | file_copies_switch--debug: | |
|
603 | file_copies_switch--debug: | |
|
604 | file_copies_switch--debug: | |
|
605 | file_copies_switch--debug: | |
|
606 | file_copies_switch--debug: | |
|
607 | files: fourth second third | |
|
608 | files: second | |
|
609 | files: | |
|
610 | files: d | |
|
611 | files: | |
|
612 | files: c | |
|
613 | files: c | |
|
614 | files: b | |
|
615 | files: a | |
|
616 | files--verbose: fourth second third | |
|
617 | files--verbose: second | |
|
618 | files--verbose: | |
|
619 | files--verbose: d | |
|
620 | files--verbose: | |
|
621 | files--verbose: c | |
|
622 | files--verbose: c | |
|
623 | files--verbose: b | |
|
624 | files--verbose: a | |
|
625 | files--debug: fourth second third | |
|
626 | files--debug: second | |
|
627 | files--debug: | |
|
628 | files--debug: d | |
|
629 | files--debug: | |
|
630 | files--debug: c | |
|
631 | files--debug: c | |
|
632 | files--debug: b | |
|
633 | files--debug: a | |
|
634 | manifest: 6:94961b75a2da | |
|
635 | manifest: 5:f2dbc354b94e | |
|
636 | manifest: 4:4dc3def4f9b4 | |
|
637 | manifest: 4:4dc3def4f9b4 | |
|
638 | manifest: 3:cb5a1327723b | |
|
639 | manifest: 3:cb5a1327723b | |
|
640 | manifest: 2:6e0e82995c35 | |
|
641 | manifest: 1:4e8d705b1e53 | |
|
642 | manifest: 0:a0c8bcbbb45c | |
|
643 | manifest--verbose: 6:94961b75a2da | |
|
644 | manifest--verbose: 5:f2dbc354b94e | |
|
645 | manifest--verbose: 4:4dc3def4f9b4 | |
|
646 | manifest--verbose: 4:4dc3def4f9b4 | |
|
647 | manifest--verbose: 3:cb5a1327723b | |
|
648 | manifest--verbose: 3:cb5a1327723b | |
|
649 | manifest--verbose: 2:6e0e82995c35 | |
|
650 | manifest--verbose: 1:4e8d705b1e53 | |
|
651 | manifest--verbose: 0:a0c8bcbbb45c | |
|
652 | manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64 | |
|
653 | manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf | |
|
654 | manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216 | |
|
655 | manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216 | |
|
656 | manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc | |
|
657 | manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc | |
|
658 | manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1 | |
|
659 | manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55 | |
|
660 | manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 | |
|
661 | node: 95c24699272ef57d062b8bccc32c878bf841784a | |
|
662 | node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453 | |
|
663 | node: d41e714fe50d9e4a5f11b4d595d543481b5f980b | |
|
664 | node: 13207e5a10d9fd28ec424934298e176197f2c67f | |
|
665 | node: bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
666 | node: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
667 | node: 97054abb4ab824450e9164180baf491ae0078465 | |
|
668 | node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965 | |
|
669 | node: 1e4e1b8f71e05681d422154f5421e385fec3454f | |
|
670 | node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a | |
|
671 | node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453 | |
|
672 | node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b | |
|
673 | node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f | |
|
674 | node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
675 | node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
676 | node--verbose: 97054abb4ab824450e9164180baf491ae0078465 | |
|
677 | node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965 | |
|
678 | node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f | |
|
679 | node--debug: 95c24699272ef57d062b8bccc32c878bf841784a | |
|
680 | node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453 | |
|
681 | node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b | |
|
682 | node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f | |
|
683 | node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
684 | node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
685 | node--debug: 97054abb4ab824450e9164180baf491ae0078465 | |
|
686 | node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965 | |
|
687 | node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f | |
|
688 | parents: | |
|
689 | parents: -1:000000000000 | |
|
690 | parents: 5:13207e5a10d9 4:bbe44766e73d | |
|
691 | parents: 3:10e46f2dcbf4 | |
|
692 | parents: | |
|
693 | parents: | |
|
694 | parents: | |
|
695 | parents: | |
|
696 | parents: | |
|
697 | parents--verbose: | |
|
698 | parents--verbose: -1:000000000000 | |
|
699 | parents--verbose: 5:13207e5a10d9 4:bbe44766e73d | |
|
700 | parents--verbose: 3:10e46f2dcbf4 | |
|
701 | parents--verbose: | |
|
702 | parents--verbose: | |
|
703 | parents--verbose: | |
|
704 | parents--verbose: | |
|
705 | parents--verbose: | |
|
706 | parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000 | |
|
707 | parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 | |
|
708 | parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
709 | parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 | |
|
710 | parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 | |
|
711 | parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000 | |
|
712 | parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000 | |
|
713 | parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000 | |
|
714 | parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 | |
|
715 | rev: 8 | |
|
716 | rev: 7 | |
|
717 | rev: 6 | |
|
718 | rev: 5 | |
|
719 | rev: 4 | |
|
720 | rev: 3 | |
|
721 | rev: 2 | |
|
722 | rev: 1 | |
|
723 | rev: 0 | |
|
724 | rev--verbose: 8 | |
|
725 | rev--verbose: 7 | |
|
726 | rev--verbose: 6 | |
|
727 | rev--verbose: 5 | |
|
728 | rev--verbose: 4 | |
|
729 | rev--verbose: 3 | |
|
730 | rev--verbose: 2 | |
|
731 | rev--verbose: 1 | |
|
732 | rev--verbose: 0 | |
|
733 | rev--debug: 8 | |
|
734 | rev--debug: 7 | |
|
735 | rev--debug: 6 | |
|
736 | rev--debug: 5 | |
|
737 | rev--debug: 4 | |
|
738 | rev--debug: 3 | |
|
739 | rev--debug: 2 | |
|
740 | rev--debug: 1 | |
|
741 | rev--debug: 0 | |
|
742 | tags: tip | |
|
743 | tags: | |
|
744 | tags: | |
|
745 | tags: | |
|
746 | tags: | |
|
747 | tags: | |
|
748 | tags: | |
|
749 | tags: | |
|
750 | tags: | |
|
751 | tags--verbose: tip | |
|
752 | tags--verbose: | |
|
753 | tags--verbose: | |
|
754 | tags--verbose: | |
|
755 | tags--verbose: | |
|
756 | tags--verbose: | |
|
757 | tags--verbose: | |
|
758 | tags--verbose: | |
|
759 | tags--verbose: | |
|
760 | tags--debug: tip | |
|
761 | tags--debug: | |
|
762 | tags--debug: | |
|
763 | tags--debug: | |
|
764 | tags--debug: | |
|
765 | tags--debug: | |
|
766 | tags--debug: | |
|
767 | tags--debug: | |
|
768 | tags--debug: | |
|
769 | diffstat: 3: +2/-1 | |
|
770 | diffstat: 1: +1/-0 | |
|
771 | diffstat: 0: +0/-0 | |
|
772 | diffstat: 1: +1/-0 | |
|
773 | diffstat: 0: +0/-0 | |
|
774 | diffstat: 1: +1/-0 | |
|
775 | diffstat: 1: +4/-0 | |
|
776 | diffstat: 1: +2/-0 | |
|
777 | diffstat: 1: +1/-0 | |
|
778 | diffstat--verbose: 3: +2/-1 | |
|
779 | diffstat--verbose: 1: +1/-0 | |
|
780 | diffstat--verbose: 0: +0/-0 | |
|
781 | diffstat--verbose: 1: +1/-0 | |
|
782 | diffstat--verbose: 0: +0/-0 | |
|
783 | diffstat--verbose: 1: +1/-0 | |
|
784 | diffstat--verbose: 1: +4/-0 | |
|
785 | diffstat--verbose: 1: +2/-0 | |
|
786 | diffstat--verbose: 1: +1/-0 | |
|
787 | diffstat--debug: 3: +2/-1 | |
|
788 | diffstat--debug: 1: +1/-0 | |
|
789 | diffstat--debug: 0: +0/-0 | |
|
790 | diffstat--debug: 1: +1/-0 | |
|
791 | diffstat--debug: 0: +0/-0 | |
|
792 | diffstat--debug: 1: +1/-0 | |
|
793 | diffstat--debug: 1: +4/-0 | |
|
794 | diffstat--debug: 1: +2/-0 | |
|
795 | diffstat--debug: 1: +1/-0 | |
|
796 | extras: branch=default | |
|
797 | extras: branch=default | |
|
798 | extras: branch=default | |
|
799 | extras: branch=default | |
|
800 | extras: branch=foo | |
|
801 | extras: branch=default | |
|
802 | extras: branch=default | |
|
803 | extras: branch=default | |
|
804 | extras: branch=default | |
|
805 | extras--verbose: branch=default | |
|
806 | extras--verbose: branch=default | |
|
807 | extras--verbose: branch=default | |
|
808 | extras--verbose: branch=default | |
|
809 | extras--verbose: branch=foo | |
|
810 | extras--verbose: branch=default | |
|
811 | extras--verbose: branch=default | |
|
812 | extras--verbose: branch=default | |
|
813 | extras--verbose: branch=default | |
|
814 | extras--debug: branch=default | |
|
815 | extras--debug: branch=default | |
|
816 | extras--debug: branch=default | |
|
817 | extras--debug: branch=default | |
|
818 | extras--debug: branch=foo | |
|
819 | extras--debug: branch=default | |
|
820 | extras--debug: branch=default | |
|
821 | extras--debug: branch=default | |
|
822 | extras--debug: branch=default | |
|
823 | p1rev: 7 | |
|
824 | p1rev: -1 | |
|
825 | p1rev: 5 | |
|
826 | p1rev: 3 | |
|
827 | p1rev: 3 | |
|
828 | p1rev: 2 | |
|
829 | p1rev: 1 | |
|
830 | p1rev: 0 | |
|
831 | p1rev: -1 | |
|
832 | p1rev--verbose: 7 | |
|
833 | p1rev--verbose: -1 | |
|
834 | p1rev--verbose: 5 | |
|
835 | p1rev--verbose: 3 | |
|
836 | p1rev--verbose: 3 | |
|
837 | p1rev--verbose: 2 | |
|
838 | p1rev--verbose: 1 | |
|
839 | p1rev--verbose: 0 | |
|
840 | p1rev--verbose: -1 | |
|
841 | p1rev--debug: 7 | |
|
842 | p1rev--debug: -1 | |
|
843 | p1rev--debug: 5 | |
|
844 | p1rev--debug: 3 | |
|
845 | p1rev--debug: 3 | |
|
846 | p1rev--debug: 2 | |
|
847 | p1rev--debug: 1 | |
|
848 | p1rev--debug: 0 | |
|
849 | p1rev--debug: -1 | |
|
850 | p2rev: -1 | |
|
851 | p2rev: -1 | |
|
852 | p2rev: 4 | |
|
853 | p2rev: -1 | |
|
854 | p2rev: -1 | |
|
855 | p2rev: -1 | |
|
856 | p2rev: -1 | |
|
857 | p2rev: -1 | |
|
858 | p2rev: -1 | |
|
859 | p2rev--verbose: -1 | |
|
860 | p2rev--verbose: -1 | |
|
861 | p2rev--verbose: 4 | |
|
862 | p2rev--verbose: -1 | |
|
863 | p2rev--verbose: -1 | |
|
864 | p2rev--verbose: -1 | |
|
865 | p2rev--verbose: -1 | |
|
866 | p2rev--verbose: -1 | |
|
867 | p2rev--verbose: -1 | |
|
868 | p2rev--debug: -1 | |
|
869 | p2rev--debug: -1 | |
|
870 | p2rev--debug: 4 | |
|
871 | p2rev--debug: -1 | |
|
872 | p2rev--debug: -1 | |
|
873 | p2rev--debug: -1 | |
|
874 | p2rev--debug: -1 | |
|
875 | p2rev--debug: -1 | |
|
876 | p2rev--debug: -1 | |
|
877 | p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453 | |
|
878 | p1node: 0000000000000000000000000000000000000000 | |
|
879 | p1node: 13207e5a10d9fd28ec424934298e176197f2c67f | |
|
880 | p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
881 | p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
882 | p1node: 97054abb4ab824450e9164180baf491ae0078465 | |
|
883 | p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965 | |
|
884 | p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f | |
|
885 | p1node: 0000000000000000000000000000000000000000 | |
|
886 | p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453 | |
|
887 | p1node--verbose: 0000000000000000000000000000000000000000 | |
|
888 | p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f | |
|
889 | p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
890 | p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
891 | p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465 | |
|
892 | p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965 | |
|
893 | p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f | |
|
894 | p1node--verbose: 0000000000000000000000000000000000000000 | |
|
895 | p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453 | |
|
896 | p1node--debug: 0000000000000000000000000000000000000000 | |
|
897 | p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f | |
|
898 | p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
899 | p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47 | |
|
900 | p1node--debug: 97054abb4ab824450e9164180baf491ae0078465 | |
|
901 | p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965 | |
|
902 | p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f | |
|
903 | p1node--debug: 0000000000000000000000000000000000000000 | |
|
904 | p2node: 0000000000000000000000000000000000000000 | |
|
905 | p2node: 0000000000000000000000000000000000000000 | |
|
906 | p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
907 | p2node: 0000000000000000000000000000000000000000 | |
|
908 | p2node: 0000000000000000000000000000000000000000 | |
|
909 | p2node: 0000000000000000000000000000000000000000 | |
|
910 | p2node: 0000000000000000000000000000000000000000 | |
|
911 | p2node: 0000000000000000000000000000000000000000 | |
|
912 | p2node: 0000000000000000000000000000000000000000 | |
|
913 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
914 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
915 | p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
916 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
917 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
918 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
919 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
920 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
921 | p2node--verbose: 0000000000000000000000000000000000000000 | |
|
922 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
923 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
924 | p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74 | |
|
925 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
926 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
927 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
928 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
929 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
930 | p2node--debug: 0000000000000000000000000000000000000000 | |
|
931 | 279 | |
|
932 | 280 | Add a dummy commit to make up for the instability of the above: |
|
933 | 281 | |
@@ -1053,31 +401,9 b' Thrown an error if a template function d' | |||
|
1053 | 401 | hg: parse error: unknown function 'foo' |
|
1054 | 402 | [255] |
|
1055 | 403 | |
|
1056 | Test index keyword: | |
|
1057 | ||
|
1058 | $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n' | |
|
1059 | 10 0:a 1:b 2:fifth 3:fourth 4:third | |
|
1060 | 11 0:a | |
|
1061 | ||
|
1062 | $ hg branches -T '{index} {branch}\n' | |
|
1063 | 0 default | |
|
1064 | 1 foo | |
|
1065 | ||
|
1066 | ui verbosity: | |
|
1067 | ||
|
1068 | $ hg log -l1 -T '{verbosity}\n' | |
|
1069 | ||
|
1070 | $ hg log -l1 -T '{verbosity}\n' --debug | |
|
1071 | debug | |
|
1072 | $ hg log -l1 -T '{verbosity}\n' --quiet | |
|
1073 | quiet | |
|
1074 | $ hg log -l1 -T '{verbosity}\n' --verbose | |
|
1075 | verbose | |
|
1076 | ||
|
1077 | 404 | $ cd .. |
|
1078 | 405 | |
|
1079 | ||
|
1080 | latesttag: | |
|
406 | Set up latesttag repository: | |
|
1081 | 407 | |
|
1082 | 408 | $ hg init latesttag |
|
1083 | 409 | $ cd latesttag |
@@ -1105,165 +431,12 b' latesttag:' | |||
|
1105 | 431 | $ hg merge -q |
|
1106 | 432 | $ hg ci -m merge -d '5 -3600' |
|
1107 | 433 | |
|
1108 | No tag set: | |
|
1109 | ||
|
1110 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
1111 | @ 5: null+5 | |
|
1112 | |\ | |
|
1113 | | o 4: null+4 | |
|
1114 | | | | |
|
1115 | | o 3: null+3 | |
|
1116 | | | | |
|
1117 | o | 2: null+3 | |
|
1118 | |/ | |
|
1119 | o 1: null+2 | |
|
1120 | | | |
|
1121 | o 0: null+1 | |
|
1122 | ||
|
1123 | ||
|
1124 | One common tag: longest path wins for {latesttagdistance}: | |
|
1125 | ||
|
1126 | 434 | $ hg tag -r 1 -m t1 -d '6 0' t1 |
|
1127 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
1128 | @ 6: t1+4 | |
|
1129 | | | |
|
1130 | o 5: t1+3 | |
|
1131 | |\ | |
|
1132 | | o 4: t1+2 | |
|
1133 | | | | |
|
1134 | | o 3: t1+1 | |
|
1135 | | | | |
|
1136 | o | 2: t1+1 | |
|
1137 | |/ | |
|
1138 | o 1: t1+0 | |
|
1139 | | | |
|
1140 | o 0: null+1 | |
|
1141 | ||
|
1142 | ||
|
1143 | One ancestor tag: closest wins: | |
|
1144 | ||
|
1145 | 435 | $ hg tag -r 2 -m t2 -d '7 0' t2 |
|
1146 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
1147 | @ 7: t2+3 | |
|
1148 | | | |
|
1149 | o 6: t2+2 | |
|
1150 | | | |
|
1151 | o 5: t2+1 | |
|
1152 | |\ | |
|
1153 | | o 4: t1+2 | |
|
1154 | | | | |
|
1155 | | o 3: t1+1 | |
|
1156 | | | | |
|
1157 | o | 2: t2+0 | |
|
1158 | |/ | |
|
1159 | o 1: t1+0 | |
|
1160 | | | |
|
1161 | o 0: null+1 | |
|
1162 | ||
|
1163 | ||
|
1164 | Two branch tags: more recent wins if same number of changes: | |
|
1165 | ||
|
1166 | 436 | $ hg tag -r 3 -m t3 -d '8 0' t3 |
|
1167 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
1168 | @ 8: t3+5 | |
|
1169 | | | |
|
1170 | o 7: t3+4 | |
|
1171 | | | |
|
1172 | o 6: t3+3 | |
|
1173 | | | |
|
1174 | o 5: t3+2 | |
|
1175 | |\ | |
|
1176 | | o 4: t3+1 | |
|
1177 | | | | |
|
1178 | | o 3: t3+0 | |
|
1179 | | | | |
|
1180 | o | 2: t2+0 | |
|
1181 | |/ | |
|
1182 | o 1: t1+0 | |
|
1183 | | | |
|
1184 | o 0: null+1 | |
|
1185 | ||
|
1186 | ||
|
1187 | Two branch tags: fewest changes wins: | |
|
1188 | ||
|
1189 | 437 | $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter |
|
1190 | $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n" | |
|
1191 | @ 9: t4+5,6 | |
|
1192 | | | |
|
1193 | o 8: t4+4,5 | |
|
1194 | | | |
|
1195 | o 7: t4+3,4 | |
|
1196 | | | |
|
1197 | o 6: t4+2,3 | |
|
1198 | | | |
|
1199 | o 5: t4+1,2 | |
|
1200 | |\ | |
|
1201 | | o 4: t4+0,0 | |
|
1202 | | | | |
|
1203 | | o 3: t3+0,0 | |
|
1204 | | | | |
|
1205 | o | 2: t2+0,0 | |
|
1206 | |/ | |
|
1207 | o 1: t1+0,0 | |
|
1208 | | | |
|
1209 | o 0: null+1,1 | |
|
1210 | ||
|
1211 | ||
|
1212 | Merged tag overrides: | |
|
1213 | ||
|
1214 | 438 | $ hg tag -r 5 -m t5 -d '9 0' t5 |
|
1215 | 439 | $ hg tag -r 3 -m at3 -d '10 0' at3 |
|
1216 | $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n' | |
|
1217 | @ 11: t5+6 | |
|
1218 | | | |
|
1219 | o 10: t5+5 | |
|
1220 | | | |
|
1221 | o 9: t5+4 | |
|
1222 | | | |
|
1223 | o 8: t5+3 | |
|
1224 | | | |
|
1225 | o 7: t5+2 | |
|
1226 | | | |
|
1227 | o 6: t5+1 | |
|
1228 | | | |
|
1229 | o 5: t5+0 | |
|
1230 | |\ | |
|
1231 | | o 4: t4+0 | |
|
1232 | | | | |
|
1233 | | o 3: at3:t3+0 | |
|
1234 | | | | |
|
1235 | o | 2: t2+0 | |
|
1236 | |/ | |
|
1237 | o 1: t1+0 | |
|
1238 | | | |
|
1239 | o 0: null+1 | |
|
1240 | ||
|
1241 | ||
|
1242 | $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n" | |
|
1243 | @ 11: t5+6,6 | |
|
1244 | | | |
|
1245 | o 10: t5+5,5 | |
|
1246 | | | |
|
1247 | o 9: t5+4,4 | |
|
1248 | | | |
|
1249 | o 8: t5+3,3 | |
|
1250 | | | |
|
1251 | o 7: t5+2,2 | |
|
1252 | | | |
|
1253 | o 6: t5+1,1 | |
|
1254 | | | |
|
1255 | o 5: t5+0,0 | |
|
1256 | |\ | |
|
1257 | | o 4: t4+0,0 | |
|
1258 | | | | |
|
1259 | | o 3: at3+0,0 t3+0,0 | |
|
1260 | | | | |
|
1261 | o | 2: t2+0,0 | |
|
1262 | |/ | |
|
1263 | o 1: t1+0,0 | |
|
1264 | | | |
|
1265 | o 0: null+1,1 | |
|
1266 | ||
|
1267 | 440 | |
|
1268 | 441 | $ cd .. |
|
1269 | 442 | |
@@ -1725,11 +898,6 b' Test recursive evaluation:' | |||
|
1725 | 898 | hg: parse error: fill expects an integer width |
|
1726 | 899 | [255] |
|
1727 | 900 | |
|
1728 | $ COLUMNS=25 hg log -l1 --template '{fill(desc, termwidth, "{node|short}:", "termwidth.{rev}:")}' | |
|
1729 | bcc7ff960b8e:desc to be | |
|
1730 | termwidth.1:wrapped desc | |
|
1731 | termwidth.1:to be wrapped (no-eol) | |
|
1732 | ||
|
1733 | 901 | $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}' |
|
1734 | 902 | {node|short} (no-eol) |
|
1735 | 903 | $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}' |
@@ -1748,97 +916,6 b' Test recursive evaluation:' | |||
|
1748 | 916 | $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}' |
|
1749 | 917 | \x1b[0;32mtext\x1b[0m (esc) |
|
1750 | 918 | |
|
1751 | Just one more commit: | |
|
1752 | ||
|
1753 | $ echo b > b | |
|
1754 | $ hg ci -qAm b | |
|
1755 | ||
|
1756 | Test 'originalnode' | |
|
1757 | ||
|
1758 | $ hg log -r 1 -T '{revset("null") % "{node|short} {originalnode|short}"}\n' | |
|
1759 | 000000000000 bcc7ff960b8e | |
|
1760 | $ hg log -r 0 -T '{manifest % "{node} {originalnode}"}\n' | |
|
1761 | a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 f7769ec2ab975ad19684098ad1ffd9b81ecc71a1 | |
|
1762 | ||
|
1763 | Test active bookmark templating | |
|
1764 | ||
|
1765 | $ hg book foo | |
|
1766 | $ hg book bar | |
|
1767 | $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n" | |
|
1768 | 2 bar* foo | |
|
1769 | 1 | |
|
1770 | 0 | |
|
1771 | $ hg log --template "{rev} {activebookmark}\n" | |
|
1772 | 2 bar | |
|
1773 | 1 | |
|
1774 | 0 | |
|
1775 | $ hg bookmarks --inactive bar | |
|
1776 | $ hg log --template "{rev} {activebookmark}\n" | |
|
1777 | 2 | |
|
1778 | 1 | |
|
1779 | 0 | |
|
1780 | $ hg book -r1 baz | |
|
1781 | $ hg log --template "{rev} {join(bookmarks, ' ')}\n" | |
|
1782 | 2 bar foo | |
|
1783 | 1 baz | |
|
1784 | 0 | |
|
1785 | $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n" | |
|
1786 | 2 t | |
|
1787 | 1 f | |
|
1788 | 0 f | |
|
1789 | ||
|
1790 | Test namespaces dict | |
|
1791 | ||
|
1792 | $ hg --config extensions.revnamesext=$TESTDIR/revnamesext.py log -T '{rev}\n{namespaces % " {namespace} color={colorname} builtin={builtin}\n {join(names, ",")}\n"}\n' | |
|
1793 | 2 | |
|
1794 | bookmarks color=bookmark builtin=True | |
|
1795 | bar,foo | |
|
1796 | tags color=tag builtin=True | |
|
1797 | tip | |
|
1798 | branches color=branch builtin=True | |
|
1799 | text.{rev} | |
|
1800 | revnames color=revname builtin=False | |
|
1801 | r2 | |
|
1802 | ||
|
1803 | 1 | |
|
1804 | bookmarks color=bookmark builtin=True | |
|
1805 | baz | |
|
1806 | tags color=tag builtin=True | |
|
1807 | ||
|
1808 | branches color=branch builtin=True | |
|
1809 | text.{rev} | |
|
1810 | revnames color=revname builtin=False | |
|
1811 | r1 | |
|
1812 | ||
|
1813 | 0 | |
|
1814 | bookmarks color=bookmark builtin=True | |
|
1815 | ||
|
1816 | tags color=tag builtin=True | |
|
1817 | ||
|
1818 | branches color=branch builtin=True | |
|
1819 | default | |
|
1820 | revnames color=revname builtin=False | |
|
1821 | r0 | |
|
1822 | ||
|
1823 | $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}' | |
|
1824 | bookmarks: bar foo | |
|
1825 | tags: tip | |
|
1826 | branches: text.{rev} | |
|
1827 | $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}' | |
|
1828 | bookmarks: | |
|
1829 | bar | |
|
1830 | foo | |
|
1831 | tags: | |
|
1832 | tip | |
|
1833 | branches: | |
|
1834 | text.{rev} | |
|
1835 | $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}' | |
|
1836 | bar | |
|
1837 | foo | |
|
1838 | $ hg log -r2 -T '{namespaces.bookmarks % "{bookmark}\n"}' | |
|
1839 | bar | |
|
1840 | foo | |
|
1841 | ||
|
1842 | 919 | $ cd .. |
|
1843 | 920 | |
|
1844 | 921 | Test bad template with better error message |
@@ -2006,155 +1083,3 b' Test that template function in extension' | |||
|
2006 | 1083 | custom |
|
2007 | 1084 | |
|
2008 | 1085 | $ cd .. |
|
2009 | ||
|
2010 | Test 'graphwidth' in 'hg log' on various topologies. The key here is that the | |
|
2011 | printed graphwidths 3, 5, 7, etc. should all line up in their respective | |
|
2012 | columns. We don't care about other aspects of the graph rendering here. | |
|
2013 | ||
|
2014 | $ hg init graphwidth | |
|
2015 | $ cd graphwidth | |
|
2016 | ||
|
2017 | $ wrappabletext="a a a a a a a a a a a a" | |
|
2018 | ||
|
2019 | $ printf "first\n" > file | |
|
2020 | $ hg add file | |
|
2021 | $ hg commit -m "$wrappabletext" | |
|
2022 | ||
|
2023 | $ printf "first\nsecond\n" > file | |
|
2024 | $ hg commit -m "$wrappabletext" | |
|
2025 | ||
|
2026 | $ hg checkout 0 | |
|
2027 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
2028 | $ printf "third\nfirst\n" > file | |
|
2029 | $ hg commit -m "$wrappabletext" | |
|
2030 | created new head | |
|
2031 | ||
|
2032 | $ hg merge | |
|
2033 | merging file | |
|
2034 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
|
2035 | (branch merge, don't forget to commit) | |
|
2036 | ||
|
2037 | $ hg log --graph -T "{graphwidth}" | |
|
2038 | @ 3 | |
|
2039 | | | |
|
2040 | | @ 5 | |
|
2041 | |/ | |
|
2042 | o 3 | |
|
2043 | ||
|
2044 | $ hg commit -m "$wrappabletext" | |
|
2045 | ||
|
2046 | $ hg log --graph -T "{graphwidth}" | |
|
2047 | @ 5 | |
|
2048 | |\ | |
|
2049 | | o 5 | |
|
2050 | | | | |
|
2051 | o | 5 | |
|
2052 | |/ | |
|
2053 | o 3 | |
|
2054 | ||
|
2055 | ||
|
2056 | $ hg checkout 0 | |
|
2057 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
2058 | $ printf "third\nfirst\nsecond\n" > file | |
|
2059 | $ hg commit -m "$wrappabletext" | |
|
2060 | created new head | |
|
2061 | ||
|
2062 | $ hg log --graph -T "{graphwidth}" | |
|
2063 | @ 3 | |
|
2064 | | | |
|
2065 | | o 7 | |
|
2066 | | |\ | |
|
2067 | +---o 7 | |
|
2068 | | | | |
|
2069 | | o 5 | |
|
2070 | |/ | |
|
2071 | o 3 | |
|
2072 | ||
|
2073 | ||
|
2074 | $ hg log --graph -T "{graphwidth}" -r 3 | |
|
2075 | o 5 | |
|
2076 | |\ | |
|
2077 | ~ ~ | |
|
2078 | ||
|
2079 | $ hg log --graph -T "{graphwidth}" -r 1 | |
|
2080 | o 3 | |
|
2081 | | | |
|
2082 | ~ | |
|
2083 | ||
|
2084 | $ hg merge | |
|
2085 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
2086 | (branch merge, don't forget to commit) | |
|
2087 | $ hg commit -m "$wrappabletext" | |
|
2088 | ||
|
2089 | $ printf "seventh\n" >> file | |
|
2090 | $ hg commit -m "$wrappabletext" | |
|
2091 | ||
|
2092 | $ hg log --graph -T "{graphwidth}" | |
|
2093 | @ 3 | |
|
2094 | | | |
|
2095 | o 5 | |
|
2096 | |\ | |
|
2097 | | o 5 | |
|
2098 | | | | |
|
2099 | o | 7 | |
|
2100 | |\ \ | |
|
2101 | | o | 7 | |
|
2102 | | |/ | |
|
2103 | o / 5 | |
|
2104 | |/ | |
|
2105 | o 3 | |
|
2106 | ||
|
2107 | ||
|
2108 | The point of graphwidth is to allow wrapping that accounts for the space taken | |
|
2109 | by the graph. | |
|
2110 | ||
|
2111 | $ COLUMNS=10 hg log --graph -T "{fill(desc, termwidth - graphwidth)}" | |
|
2112 | @ a a a a | |
|
2113 | | a a a a | |
|
2114 | | a a a a | |
|
2115 | o a a a | |
|
2116 | |\ a a a | |
|
2117 | | | a a a | |
|
2118 | | | a a a | |
|
2119 | | o a a a | |
|
2120 | | | a a a | |
|
2121 | | | a a a | |
|
2122 | | | a a a | |
|
2123 | o | a a | |
|
2124 | |\ \ a a | |
|
2125 | | | | a a | |
|
2126 | | | | a a | |
|
2127 | | | | a a | |
|
2128 | | | | a a | |
|
2129 | | o | a a | |
|
2130 | | |/ a a | |
|
2131 | | | a a | |
|
2132 | | | a a | |
|
2133 | | | a a | |
|
2134 | | | a a | |
|
2135 | o | a a a | |
|
2136 | |/ a a a | |
|
2137 | | a a a | |
|
2138 | | a a a | |
|
2139 | o a a a a | |
|
2140 | a a a a | |
|
2141 | a a a a | |
|
2142 | ||
|
2143 | Something tricky happens when there are elided nodes; the next drawn row of | |
|
2144 | edges can be more than one column wider, but the graph width only increases by | |
|
2145 | one column. The remaining columns are added in between the nodes. | |
|
2146 | ||
|
2147 | $ hg log --graph -T "{graphwidth}" -r "0|2|4|5" | |
|
2148 | o 5 | |
|
2149 | |\ | |
|
2150 | | \ | |
|
2151 | | :\ | |
|
2152 | o : : 7 | |
|
2153 | :/ / | |
|
2154 | : o 5 | |
|
2155 | :/ | |
|
2156 | o 3 | |
|
2157 | ||
|
2158 | ||
|
2159 | $ cd .. | |
|
2160 |
This diff has been collapsed as it changes many lines, (975 lines changed) Show them Hide them | |||
@@ -1,3 +1,6 b'' | |||
|
1 | Test template keywords | |
|
2 | ====================== | |
|
3 | ||
|
1 | 4 |
$ |
|
2 | 5 | $ cd a |
|
3 | 6 | $ echo a > a |
@@ -29,165 +32,6 b'' | |||
|
29 | 32 |
$ |
|
30 | 33 | $ hg commit -m 'merge' -d '1500001 0' -u 'person' |
|
31 | 34 | |
|
32 | Test arithmetic operators have the right precedence: | |
|
33 | ||
|
34 | $ hg log -l 1 -T '{date(date, "%Y") + 5 * 10} {date(date, "%Y") - 2 * 3}\n' | |
|
35 | 2020 1964 | |
|
36 | $ hg log -l 1 -T '{date(date, "%Y") * 5 + 10} {date(date, "%Y") * 3 - 2}\n' | |
|
37 | 9860 5908 | |
|
38 | ||
|
39 | Test division: | |
|
40 | ||
|
41 | $ hg debugtemplate -r0 -v '{5 / 2} {mod(5, 2)}\n' | |
|
42 | (template | |
|
43 | (/ | |
|
44 | (integer '5') | |
|
45 | (integer '2')) | |
|
46 | (string ' ') | |
|
47 | (func | |
|
48 | (symbol 'mod') | |
|
49 | (list | |
|
50 | (integer '5') | |
|
51 | (integer '2'))) | |
|
52 | (string '\n')) | |
|
53 | * keywords: | |
|
54 | * functions: mod | |
|
55 | 2 1 | |
|
56 | $ hg debugtemplate -r0 -v '{5 / -2} {mod(5, -2)}\n' | |
|
57 | (template | |
|
58 | (/ | |
|
59 | (integer '5') | |
|
60 | (negate | |
|
61 | (integer '2'))) | |
|
62 | (string ' ') | |
|
63 | (func | |
|
64 | (symbol 'mod') | |
|
65 | (list | |
|
66 | (integer '5') | |
|
67 | (negate | |
|
68 | (integer '2')))) | |
|
69 | (string '\n')) | |
|
70 | * keywords: | |
|
71 | * functions: mod | |
|
72 | -3 -1 | |
|
73 | $ hg debugtemplate -r0 -v '{-5 / 2} {mod(-5, 2)}\n' | |
|
74 | (template | |
|
75 | (/ | |
|
76 | (negate | |
|
77 | (integer '5')) | |
|
78 | (integer '2')) | |
|
79 | (string ' ') | |
|
80 | (func | |
|
81 | (symbol 'mod') | |
|
82 | (list | |
|
83 | (negate | |
|
84 | (integer '5')) | |
|
85 | (integer '2'))) | |
|
86 | (string '\n')) | |
|
87 | * keywords: | |
|
88 | * functions: mod | |
|
89 | -3 1 | |
|
90 | $ hg debugtemplate -r0 -v '{-5 / -2} {mod(-5, -2)}\n' | |
|
91 | (template | |
|
92 | (/ | |
|
93 | (negate | |
|
94 | (integer '5')) | |
|
95 | (negate | |
|
96 | (integer '2'))) | |
|
97 | (string ' ') | |
|
98 | (func | |
|
99 | (symbol 'mod') | |
|
100 | (list | |
|
101 | (negate | |
|
102 | (integer '5')) | |
|
103 | (negate | |
|
104 | (integer '2')))) | |
|
105 | (string '\n')) | |
|
106 | * keywords: | |
|
107 | * functions: mod | |
|
108 | 2 -1 | |
|
109 | ||
|
110 | Filters bind closer than arithmetic: | |
|
111 | ||
|
112 | $ hg debugtemplate -r0 -v '{revset(".")|count - 1}\n' | |
|
113 | (template | |
|
114 | (- | |
|
115 | (| | |
|
116 | (func | |
|
117 | (symbol 'revset') | |
|
118 | (string '.')) | |
|
119 | (symbol 'count')) | |
|
120 | (integer '1')) | |
|
121 | (string '\n')) | |
|
122 | * keywords: | |
|
123 | * functions: count, revset | |
|
124 | 0 | |
|
125 | ||
|
126 | But negate binds closer still: | |
|
127 | ||
|
128 | $ hg debugtemplate -r0 -v '{1-3|stringify}\n' | |
|
129 | (template | |
|
130 | (- | |
|
131 | (integer '1') | |
|
132 | (| | |
|
133 | (integer '3') | |
|
134 | (symbol 'stringify'))) | |
|
135 | (string '\n')) | |
|
136 | * keywords: | |
|
137 | * functions: stringify | |
|
138 | hg: parse error: arithmetic only defined on integers | |
|
139 | [255] | |
|
140 | $ hg debugtemplate -r0 -v '{-3|stringify}\n' | |
|
141 | (template | |
|
142 | (| | |
|
143 | (negate | |
|
144 | (integer '3')) | |
|
145 | (symbol 'stringify')) | |
|
146 | (string '\n')) | |
|
147 | * keywords: | |
|
148 | * functions: stringify | |
|
149 | -3 | |
|
150 | ||
|
151 | Filters bind as close as map operator: | |
|
152 | ||
|
153 | $ hg debugtemplate -r0 -v '{desc|splitlines % "{line}\n"}' | |
|
154 | (template | |
|
155 | (% | |
|
156 | (| | |
|
157 | (symbol 'desc') | |
|
158 | (symbol 'splitlines')) | |
|
159 | (template | |
|
160 | (symbol 'line') | |
|
161 | (string '\n')))) | |
|
162 | * keywords: desc, line | |
|
163 | * functions: splitlines | |
|
164 | line 1 | |
|
165 | line 2 | |
|
166 | ||
|
167 | Keyword arguments: | |
|
168 | ||
|
169 | $ hg debugtemplate -r0 -v '{foo=bar|baz}' | |
|
170 | (template | |
|
171 | (keyvalue | |
|
172 | (symbol 'foo') | |
|
173 | (| | |
|
174 | (symbol 'bar') | |
|
175 | (symbol 'baz')))) | |
|
176 | * keywords: bar, foo | |
|
177 | * functions: baz | |
|
178 | hg: parse error: can't use a key-value pair in this context | |
|
179 | [255] | |
|
180 | ||
|
181 | $ hg debugtemplate '{pad("foo", width=10, left=true)}\n' | |
|
182 | foo | |
|
183 | ||
|
184 | Call function which takes named arguments by filter syntax: | |
|
185 | ||
|
186 | $ hg debugtemplate '{" "|separate}' | |
|
187 | $ hg debugtemplate '{("not", "an", "argument", "list")|separate}' | |
|
188 | hg: parse error: unknown method 'list' | |
|
189 | [255] | |
|
190 | ||
|
191 | 35 | Second branch starting at nullrev: |
|
192 | 36 | |
|
193 | 37 | $ hg update null |
@@ -202,14 +46,6 b' Second branch starting at nullrev:' | |||
|
202 | 46 | $ hg mv second fourth |
|
203 | 47 | $ hg commit -m third -d "2020-01-01 10:01" |
|
204 | 48 | |
|
205 | $ hg log --template '{join(file_copies, ",\n")}\n' -r . | |
|
206 | fourth (second) | |
|
207 | $ hg log -T '{file_copies % "{source} -> {name}\n"}' -r . | |
|
208 | second -> fourth | |
|
209 | $ hg log -T '{rev} {ifcontains("fourth", file_copies, "t", "f")}\n' -r .:7 | |
|
210 | 8 t | |
|
211 | 7 f | |
|
212 | ||
|
213 | 49 | Working-directory revision has special identifiers, though they are still |
|
214 | 50 | experimental: |
|
215 | 51 | |
@@ -222,68 +58,6 b' never cause crash:' | |||
|
222 | 58 | $ hg log -r 'wdir()' -T '{manifest}\n' |
|
223 | 59 | |
|
224 | 60 | |
|
225 | Internal resources shouldn't be exposed (issue5699): | |
|
226 | ||
|
227 | $ hg log -r. -T '{cache}{ctx}{repo}{revcache}{templ}{ui}' | |
|
228 | ||
|
229 | Never crash on internal resource not available: | |
|
230 | ||
|
231 | $ hg --cwd .. debugtemplate '{"c0bebeef"|shortest}\n' | |
|
232 | abort: template resource not available: repo | |
|
233 | [255] | |
|
234 | ||
|
235 | $ hg config -T '{author}' | |
|
236 | ||
|
237 | Quoting for ui.logtemplate | |
|
238 | ||
|
239 | $ hg tip --config "ui.logtemplate={rev}\n" | |
|
240 | 8 | |
|
241 | $ hg tip --config "ui.logtemplate='{rev}\n'" | |
|
242 | 8 | |
|
243 | $ hg tip --config 'ui.logtemplate="{rev}\n"' | |
|
244 | 8 | |
|
245 | $ hg tip --config 'ui.logtemplate=n{rev}\n' | |
|
246 | n8 | |
|
247 | ||
|
248 | Check that recursive reference does not fall into RuntimeError (issue4758): | |
|
249 | ||
|
250 | common mistake: | |
|
251 | ||
|
252 | $ cat << EOF > issue4758 | |
|
253 | > changeset = '{changeset}\n' | |
|
254 | > EOF | |
|
255 | $ hg log --style ./issue4758 | |
|
256 | abort: recursive reference 'changeset' in template | |
|
257 | [255] | |
|
258 | ||
|
259 | circular reference: | |
|
260 | ||
|
261 | $ cat << EOF > issue4758 | |
|
262 | > changeset = '{foo}' | |
|
263 | > foo = '{changeset}' | |
|
264 | > EOF | |
|
265 | $ hg log --style ./issue4758 | |
|
266 | abort: recursive reference 'foo' in template | |
|
267 | [255] | |
|
268 | ||
|
269 | buildmap() -> gettemplate(), where no thunk was made: | |
|
270 | ||
|
271 | $ cat << EOF > issue4758 | |
|
272 | > changeset = '{files % changeset}\n' | |
|
273 | > EOF | |
|
274 | $ hg log --style ./issue4758 | |
|
275 | abort: recursive reference 'changeset' in template | |
|
276 | [255] | |
|
277 | ||
|
278 | not a recursion if a keyword of the same name exists: | |
|
279 | ||
|
280 | $ cat << EOF > issue4758 | |
|
281 | > changeset = '{tags % rev}' | |
|
282 | > rev = '{rev} {tag}\n' | |
|
283 | > EOF | |
|
284 | $ hg log --style ./issue4758 -r tip | |
|
285 | 8 tip | |
|
286 | ||
|
287 | 61 | Check that {phase} works correctly on parents: |
|
288 | 62 | |
|
289 | 63 | $ cat << EOF > parentphase |
@@ -944,115 +718,6 b' Add a commit that does all possible modi' | |||
|
944 | 718 | $ hg rm a |
|
945 | 719 | $ hg ci -m "Modify, add, remove, rename" |
|
946 | 720 | |
|
947 | Error on syntax: | |
|
948 | ||
|
949 | $ cat <<EOF > t | |
|
950 | > changeset = '{c}' | |
|
951 | > c = q | |
|
952 | > x = "f | |
|
953 | > EOF | |
|
954 | $ echo '[ui]' > .hg/hgrc | |
|
955 | $ echo 'style = t' >> .hg/hgrc | |
|
956 | $ hg log | |
|
957 | hg: parse error at t:3: unmatched quotes | |
|
958 | [255] | |
|
959 | ||
|
960 | $ hg log -T '{date' | |
|
961 | hg: parse error at 1: unterminated template expansion | |
|
962 | ({date | |
|
963 | ^ here) | |
|
964 | [255] | |
|
965 | $ hg log -T '{date(}' | |
|
966 | hg: parse error at 6: not a prefix: end | |
|
967 | ({date(} | |
|
968 | ^ here) | |
|
969 | [255] | |
|
970 | $ hg log -T '{date)}' | |
|
971 | hg: parse error at 5: invalid token | |
|
972 | ({date)} | |
|
973 | ^ here) | |
|
974 | [255] | |
|
975 | $ hg log -T '{date date}' | |
|
976 | hg: parse error at 6: invalid token | |
|
977 | ({date date} | |
|
978 | ^ here) | |
|
979 | [255] | |
|
980 | ||
|
981 | $ hg log -T '{}' | |
|
982 | hg: parse error at 1: not a prefix: end | |
|
983 | ({} | |
|
984 | ^ here) | |
|
985 | [255] | |
|
986 | $ hg debugtemplate -v '{()}' | |
|
987 | (template | |
|
988 | (group | |
|
989 | None)) | |
|
990 | * keywords: | |
|
991 | * functions: | |
|
992 | hg: parse error: missing argument | |
|
993 | [255] | |
|
994 | ||
|
995 | Behind the scenes, this would throw TypeError without intype=bytes | |
|
996 | ||
|
997 | $ hg log -l 3 --template '{date|obfuscate}\n' | |
|
998 | 0.00 | |
|
999 | 0.00 | |
|
1000 | 1577872860.00 | |
|
1001 | ||
|
1002 | Behind the scenes, this will throw a ValueError | |
|
1003 | ||
|
1004 | $ hg log -l 3 --template 'line: {desc|shortdate}\n' | |
|
1005 | hg: parse error: invalid date: 'Modify, add, remove, rename' | |
|
1006 | (template filter 'shortdate' is not compatible with keyword 'desc') | |
|
1007 | [255] | |
|
1008 | ||
|
1009 | Behind the scenes, this would throw AttributeError without intype=bytes | |
|
1010 | ||
|
1011 | $ hg log -l 3 --template 'line: {date|escape}\n' | |
|
1012 | line: 0.00 | |
|
1013 | line: 0.00 | |
|
1014 | line: 1577872860.00 | |
|
1015 | ||
|
1016 | $ hg log -l 3 --template 'line: {extras|localdate}\n' | |
|
1017 | hg: parse error: localdate expects a date information | |
|
1018 | [255] | |
|
1019 | ||
|
1020 | Behind the scenes, this will throw ValueError | |
|
1021 | ||
|
1022 | $ hg tip --template '{author|email|date}\n' | |
|
1023 | hg: parse error: date expects a date information | |
|
1024 | [255] | |
|
1025 | ||
|
1026 | $ hg tip -T '{author|email|shortdate}\n' | |
|
1027 | hg: parse error: invalid date: 'test' | |
|
1028 | (template filter 'shortdate' is not compatible with keyword 'author') | |
|
1029 | [255] | |
|
1030 | ||
|
1031 | $ hg tip -T '{get(extras, "branch")|shortdate}\n' | |
|
1032 | hg: parse error: invalid date: 'default' | |
|
1033 | (incompatible use of template filter 'shortdate') | |
|
1034 | [255] | |
|
1035 | ||
|
1036 | Error in nested template: | |
|
1037 | ||
|
1038 | $ hg log -T '{"date' | |
|
1039 | hg: parse error at 2: unterminated string | |
|
1040 | ({"date | |
|
1041 | ^ here) | |
|
1042 | [255] | |
|
1043 | ||
|
1044 | $ hg log -T '{"foo{date|?}"}' | |
|
1045 | hg: parse error at 11: syntax error | |
|
1046 | ({"foo{date|?}"} | |
|
1047 | ^ here) | |
|
1048 | [255] | |
|
1049 | ||
|
1050 | Thrown an error if a template function doesn't exist | |
|
1051 | ||
|
1052 | $ hg tip --template '{foo()}\n' | |
|
1053 | hg: parse error: unknown function 'foo' | |
|
1054 | [255] | |
|
1055 | ||
|
1056 | 721 | Test index keyword: |
|
1057 | 722 | |
|
1058 | 723 | $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n' |
@@ -1076,7 +741,6 b' ui verbosity:' | |||
|
1076 | 741 | |
|
1077 | 742 | $ cd .. |
|
1078 | 743 | |
|
1079 | ||
|
1080 | 744 | latesttag: |
|
1081 | 745 | |
|
1082 | 746 | $ hg init latesttag |
@@ -1267,487 +931,25 b' Merged tag overrides:' | |||
|
1267 | 931 | |
|
1268 | 932 | $ cd .. |
|
1269 | 933 | |
|
1270 | Test new-style inline templating: | |
|
1271 | ||
|
1272 | $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n' | |
|
1273 | modified files: .hgtags | |
|
1274 | ||
|
1275 | ||
|
1276 | $ hg log -R latesttag -r tip -T '{rev % "a"}\n' | |
|
1277 | hg: parse error: 11 is not iterable of mappings | |
|
1278 | (keyword 'rev' does not support map operation) | |
|
1279 | [255] | |
|
1280 | $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n' | |
|
1281 | hg: parse error: None is not iterable of mappings | |
|
1282 | [255] | |
|
1283 | $ hg log -R latesttag -r tip -T '{extras % "{key}\n" % "{key}\n"}' | |
|
1284 | hg: parse error: list of strings is not mappable | |
|
1285 | [255] | |
|
1286 | ||
|
1287 | Test new-style inline templating of non-list/dict type: | |
|
1288 | ||
|
1289 | $ hg log -R latesttag -r tip -T '{manifest}\n' | |
|
1290 | 11:2bc6e9006ce2 | |
|
1291 | $ hg log -R latesttag -r tip -T 'string length: {manifest|count}\n' | |
|
1292 | string length: 15 | |
|
1293 | $ hg log -R latesttag -r tip -T '{manifest % "{rev}:{node}"}\n' | |
|
1294 | 11:2bc6e9006ce29882383a22d39fd1f4e66dd3e2fc | |
|
1295 | ||
|
1296 | $ hg log -R latesttag -r tip -T '{get(extras, "branch") % "{key}: {value}\n"}' | |
|
1297 | branch: default | |
|
1298 | $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "{key}\n"}' | |
|
1299 | hg: parse error: None is not iterable of mappings | |
|
1300 | [255] | |
|
1301 | $ hg log -R latesttag -r tip -T '{min(extras) % "{key}: {value}\n"}' | |
|
1302 | branch: default | |
|
1303 | $ hg log -R latesttag -l1 -T '{min(revset("0:9")) % "{rev}:{node|short}\n"}' | |
|
1304 | 0:ce3cec86e6c2 | |
|
1305 | $ hg log -R latesttag -l1 -T '{max(revset("0:9")) % "{rev}:{node|short}\n"}' | |
|
1306 | 9:fbc7cd862e9c | |
|
1307 | ||
|
1308 | Test dot operator precedence: | |
|
1309 | ||
|
1310 | $ hg debugtemplate -R latesttag -r0 -v '{manifest.node|short}\n' | |
|
1311 | (template | |
|
1312 | (| | |
|
1313 | (. | |
|
1314 | (symbol 'manifest') | |
|
1315 | (symbol 'node')) | |
|
1316 | (symbol 'short')) | |
|
1317 | (string '\n')) | |
|
1318 | * keywords: manifest, node, rev | |
|
1319 | * functions: formatnode, short | |
|
1320 | 89f4071fec70 | |
|
1321 | ||
|
1322 | (the following examples are invalid, but seem natural in parsing POV) | |
|
1323 | ||
|
1324 | $ hg debugtemplate -R latesttag -r0 -v '{foo|bar.baz}\n' 2> /dev/null | |
|
1325 | (template | |
|
1326 | (| | |
|
1327 | (symbol 'foo') | |
|
1328 | (. | |
|
1329 | (symbol 'bar') | |
|
1330 | (symbol 'baz'))) | |
|
1331 | (string '\n')) | |
|
1332 | [255] | |
|
1333 | $ hg debugtemplate -R latesttag -r0 -v '{foo.bar()}\n' 2> /dev/null | |
|
1334 | (template | |
|
1335 | (. | |
|
1336 | (symbol 'foo') | |
|
1337 | (func | |
|
1338 | (symbol 'bar') | |
|
1339 | None)) | |
|
1340 | (string '\n')) | |
|
1341 | * keywords: foo | |
|
1342 | * functions: bar | |
|
1343 | [255] | |
|
1344 | ||
|
1345 | Test evaluation of dot operator: | |
|
1346 | ||
|
1347 | $ hg log -R latesttag -l1 -T '{min(revset("0:9")).node}\n' | |
|
1348 | ce3cec86e6c26bd9bdfc590a6b92abc9680f1796 | |
|
1349 | $ hg log -R latesttag -r0 -T '{extras.branch}\n' | |
|
1350 | default | |
|
1351 | $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n' | |
|
1352 | 0 -7200 | |
|
1353 | ||
|
1354 | $ hg log -R latesttag -l1 -T '{author.invalid}\n' | |
|
1355 | hg: parse error: 'test' is not a dictionary | |
|
1356 | (keyword 'author' does not support member operation) | |
|
1357 | [255] | |
|
1358 | $ hg log -R latesttag -l1 -T '{min("abc").invalid}\n' | |
|
1359 | hg: parse error: 'a' is not a dictionary | |
|
1360 | [255] | |
|
1361 | ||
|
1362 | Test integer literal: | |
|
1363 | ||
|
1364 | $ hg debugtemplate -v '{(0)}\n' | |
|
1365 | (template | |
|
1366 | (group | |
|
1367 | (integer '0')) | |
|
1368 | (string '\n')) | |
|
1369 | * keywords: | |
|
1370 | * functions: | |
|
1371 | 0 | |
|
1372 | $ hg debugtemplate -v '{(123)}\n' | |
|
1373 | (template | |
|
1374 | (group | |
|
1375 | (integer '123')) | |
|
1376 | (string '\n')) | |
|
1377 | * keywords: | |
|
1378 | * functions: | |
|
1379 | 123 | |
|
1380 | $ hg debugtemplate -v '{(-4)}\n' | |
|
1381 | (template | |
|
1382 | (group | |
|
1383 | (negate | |
|
1384 | (integer '4'))) | |
|
1385 | (string '\n')) | |
|
1386 | * keywords: | |
|
1387 | * functions: | |
|
1388 | -4 | |
|
1389 | $ hg debugtemplate '{(-)}\n' | |
|
1390 | hg: parse error at 3: not a prefix: ) | |
|
1391 | ({(-)}\n | |
|
1392 | ^ here) | |
|
1393 | [255] | |
|
1394 | $ hg debugtemplate '{(-a)}\n' | |
|
1395 | hg: parse error: negation needs an integer argument | |
|
1396 | [255] | |
|
1397 | ||
|
1398 | top-level integer literal is interpreted as symbol (i.e. variable name): | |
|
1399 | ||
|
1400 | $ hg debugtemplate -D 1=one -v '{1}\n' | |
|
1401 | (template | |
|
1402 | (integer '1') | |
|
1403 | (string '\n')) | |
|
1404 | * keywords: | |
|
1405 | * functions: | |
|
1406 | one | |
|
1407 | $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n' | |
|
1408 | (template | |
|
1409 | (func | |
|
1410 | (symbol 'if') | |
|
1411 | (list | |
|
1412 | (string 't') | |
|
1413 | (template | |
|
1414 | (integer '1')))) | |
|
1415 | (string '\n')) | |
|
1416 | * keywords: | |
|
1417 | * functions: if | |
|
1418 | one | |
|
1419 | $ hg debugtemplate -D 1=one -v '{1|stringify}\n' | |
|
1420 | (template | |
|
1421 | (| | |
|
1422 | (integer '1') | |
|
1423 | (symbol 'stringify')) | |
|
1424 | (string '\n')) | |
|
1425 | * keywords: | |
|
1426 | * functions: stringify | |
|
1427 | one | |
|
1428 | ||
|
1429 | unless explicit symbol is expected: | |
|
1430 | ||
|
1431 | $ hg log -Ra -r0 -T '{desc|1}\n' | |
|
1432 | hg: parse error: expected a symbol, got 'integer' | |
|
1433 | [255] | |
|
1434 | $ hg log -Ra -r0 -T '{1()}\n' | |
|
1435 | hg: parse error: expected a symbol, got 'integer' | |
|
1436 | [255] | |
|
1437 | ||
|
1438 | Test string literal: | |
|
1439 | ||
|
1440 | $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n' | |
|
1441 | (template | |
|
1442 | (string 'string with no template fragment') | |
|
1443 | (string '\n')) | |
|
1444 | * keywords: | |
|
1445 | * functions: | |
|
1446 | string with no template fragment | |
|
1447 | $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n' | |
|
1448 | (template | |
|
1449 | (template | |
|
1450 | (string 'template: ') | |
|
1451 | (symbol 'rev')) | |
|
1452 | (string '\n')) | |
|
1453 | * keywords: rev | |
|
1454 | * functions: | |
|
1455 | template: 0 | |
|
1456 | $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n' | |
|
1457 | (template | |
|
1458 | (string 'rawstring: {rev}') | |
|
1459 | (string '\n')) | |
|
1460 | * keywords: | |
|
1461 | * functions: | |
|
1462 | rawstring: {rev} | |
|
1463 | $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n' | |
|
1464 | (template | |
|
1465 | (% | |
|
1466 | (symbol 'files') | |
|
1467 | (string 'rawstring: {file}')) | |
|
1468 | (string '\n')) | |
|
1469 | * keywords: files | |
|
1470 | * functions: | |
|
1471 | rawstring: {file} | |
|
1472 | ||
|
1473 | Test string escaping: | |
|
1474 | ||
|
1475 | $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' | |
|
1476 | > | |
|
1477 | <>\n<[> | |
|
1478 | <>\n<]> | |
|
1479 | <>\n< | |
|
1480 | ||
|
1481 | $ hg log -R latesttag -r 0 \ | |
|
1482 | > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' | |
|
1483 | > | |
|
1484 | <>\n<[> | |
|
1485 | <>\n<]> | |
|
1486 | <>\n< | |
|
1487 | ||
|
1488 | $ hg log -R latesttag -r 0 -T esc \ | |
|
1489 | > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' | |
|
1490 | > | |
|
1491 | <>\n<[> | |
|
1492 | <>\n<]> | |
|
1493 | <>\n< | |
|
1494 | ||
|
1495 | $ cat <<'EOF' > esctmpl | |
|
1496 | > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n' | |
|
1497 | > EOF | |
|
1498 | $ hg log -R latesttag -r 0 --style ./esctmpl | |
|
1499 | > | |
|
1500 | <>\n<[> | |
|
1501 | <>\n<]> | |
|
1502 | <>\n< | |
|
1503 | ||
|
1504 | Test string escaping of quotes: | |
|
1505 | ||
|
1506 | $ hg log -Ra -r0 -T '{"\""}\n' | |
|
1507 | " | |
|
1508 | $ hg log -Ra -r0 -T '{"\\\""}\n' | |
|
1509 | \" | |
|
1510 | $ hg log -Ra -r0 -T '{r"\""}\n' | |
|
1511 | \" | |
|
1512 | $ hg log -Ra -r0 -T '{r"\\\""}\n' | |
|
1513 | \\\" | |
|
1514 | ||
|
1515 | ||
|
1516 | $ hg log -Ra -r0 -T '{"\""}\n' | |
|
1517 | " | |
|
1518 | $ hg log -Ra -r0 -T '{"\\\""}\n' | |
|
1519 | \" | |
|
1520 | $ hg log -Ra -r0 -T '{r"\""}\n' | |
|
1521 | \" | |
|
1522 | $ hg log -Ra -r0 -T '{r"\\\""}\n' | |
|
1523 | \\\" | |
|
1524 | ||
|
1525 | Test exception in quoted template. single backslash before quotation mark is | |
|
1526 | stripped before parsing: | |
|
1527 | ||
|
1528 | $ cat <<'EOF' > escquotetmpl | |
|
1529 | > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n" | |
|
1530 | > EOF | |
|
1531 | $ cd latesttag | |
|
1532 | $ hg log -r 2 --style ../escquotetmpl | |
|
1533 | " \" \" \\" head1 | |
|
1534 | ||
|
1535 | $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"' | |
|
1536 | valid | |
|
1537 | $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'" | |
|
1538 | valid | |
|
1539 | ||
|
1540 | Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested | |
|
1541 | _evalifliteral() templates (issue4733): | |
|
1542 | ||
|
1543 | $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n' | |
|
1544 | "2 | |
|
1545 | $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n' | |
|
1546 | "2 | |
|
1547 | $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n' | |
|
1548 | "2 | |
|
1549 | ||
|
1550 | $ hg log -r 2 -T '{if(rev, "\\\"")}\n' | |
|
1551 | \" | |
|
1552 | $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n' | |
|
1553 | \" | |
|
1554 | $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n' | |
|
1555 | \" | |
|
1556 | ||
|
1557 | $ hg log -r 2 -T '{if(rev, r"\\\"")}\n' | |
|
1558 | \\\" | |
|
1559 | $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n' | |
|
1560 | \\\" | |
|
1561 | $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n' | |
|
1562 | \\\" | |
|
1563 | ||
|
1564 | escaped single quotes and errors: | |
|
1565 | ||
|
1566 | $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n' | |
|
1567 | foo | |
|
1568 | $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n' | |
|
1569 | foo | |
|
1570 | $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n' | |
|
1571 | hg: parse error at 21: unterminated string | |
|
1572 | ({if(rev, "{if(rev, \")}")}\n | |
|
1573 | ^ here) | |
|
1574 | [255] | |
|
1575 | $ hg log -r 2 -T '{if(rev, \"\\"")}\n' | |
|
1576 | hg: parse error: trailing \ in string | |
|
1577 | [255] | |
|
1578 | $ hg log -r 2 -T '{if(rev, r\"\\"")}\n' | |
|
1579 | hg: parse error: trailing \ in string | |
|
1580 | [255] | |
|
1581 | ||
|
1582 | $ cd .. | |
|
1583 | ||
|
1584 | Test leading backslashes: | |
|
1585 | ||
|
1586 | $ cd latesttag | |
|
1587 | $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n' | |
|
1588 | {rev} {file} | |
|
1589 | $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n' | |
|
1590 | \2 \head1 | |
|
1591 | $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n' | |
|
1592 | \{rev} \{file} | |
|
1593 | $ cd .. | |
|
1594 | ||
|
1595 | Test leading backslashes in "if" expression (issue4714): | |
|
1596 | ||
|
1597 | $ cd latesttag | |
|
1598 | $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n' | |
|
1599 | {rev} \{rev} | |
|
1600 | $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n' | |
|
1601 | \2 \\{rev} | |
|
1602 | $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n' | |
|
1603 | \{rev} \\\{rev} | |
|
1604 | $ cd .. | |
|
1605 | ||
|
1606 | "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice) | |
|
1607 | ||
|
1608 | $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n' | |
|
1609 | \x6e | |
|
1610 | $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n' | |
|
1611 | \x5c\x786e | |
|
1612 | $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n' | |
|
1613 | \x6e | |
|
1614 | $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n' | |
|
1615 | \x5c\x786e | |
|
1616 | ||
|
1617 | $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n' | |
|
1618 | \x6e | |
|
1619 | $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n' | |
|
1620 | \x5c\x786e | |
|
1621 | $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n' | |
|
1622 | \x6e | |
|
1623 | $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n' | |
|
1624 | \x5c\x786e | |
|
1625 | ||
|
1626 | $ hg log -R a -r 8 --template '{join(files, "\n")}\n' | |
|
1627 | fourth | |
|
1628 | second | |
|
1629 | third | |
|
1630 | $ hg log -R a -r 8 --template '{join(files, r"\n")}\n' | |
|
1631 | fourth\nsecond\nthird | |
|
1632 | ||
|
1633 | $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}' | |
|
1634 | <p> | |
|
1635 | 1st | |
|
1636 | </p> | |
|
1637 | <p> | |
|
1638 | 2nd | |
|
1639 | </p> | |
|
1640 | $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}' | |
|
1641 | <p> | |
|
1642 | 1st\n\n2nd | |
|
1643 | </p> | |
|
1644 | $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}' | |
|
1645 | 1st | |
|
1646 | ||
|
1647 | 2nd | |
|
1648 | ||
|
1649 | $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n' | |
|
1650 | o perso | |
|
1651 | $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n' | |
|
1652 | no person | |
|
1653 | $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n' | |
|
1654 | o perso | |
|
1655 | $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n' | |
|
1656 | no perso | |
|
1657 | ||
|
1658 | $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n' | |
|
1659 | -o perso- | |
|
1660 | $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n' | |
|
1661 | no person | |
|
1662 | $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n' | |
|
1663 | \x2do perso\x2d | |
|
1664 | $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n' | |
|
1665 | -o perso- | |
|
1666 | $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n' | |
|
1667 | \x2do perso\x6e | |
|
1668 | ||
|
1669 | $ hg log -R a -r 8 --template '{files % "{file}\n"}' | |
|
1670 | fourth | |
|
1671 | second | |
|
1672 | third | |
|
1673 | ||
|
1674 | Test string escaping in nested expression: | |
|
1675 | ||
|
1676 | $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n' | |
|
1677 | fourth\x6esecond\x6ethird | |
|
1678 | $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n' | |
|
1679 | fourth\x6esecond\x6ethird | |
|
1680 | ||
|
1681 | $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n' | |
|
1682 | fourth\x6esecond\x6ethird | |
|
1683 | $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n' | |
|
1684 | fourth\x5c\x786esecond\x5c\x786ethird | |
|
1685 | ||
|
1686 | $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n' | |
|
1687 | 3:\x6eo user, \x6eo domai\x6e | |
|
1688 | 4:\x5c\x786eew bra\x5c\x786ech | |
|
1689 | ||
|
1690 | Test quotes in nested expression are evaluated just like a $(command) | |
|
1691 | substitution in POSIX shells: | |
|
1692 | ||
|
1693 | $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n' | |
|
1694 | 8:95c24699272e | |
|
1695 | $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n' | |
|
1696 | {8} "95c24699272e" | |
|
1697 | ||
|
1698 | Test recursive evaluation: | |
|
934 | Set up repository containing template fragments in commit metadata: | |
|
1699 | 935 | |
|
1700 | 936 | $ hg init r |
|
1701 | 937 | $ cd r |
|
1702 | 938 | $ echo a > a |
|
1703 | 939 | $ hg ci -Am '{rev}' |
|
1704 | 940 | adding a |
|
1705 | $ hg log -r 0 --template '{if(rev, desc)}\n' | |
|
1706 | {rev} | |
|
1707 | $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n' | |
|
1708 | test 0 | |
|
1709 | 941 | |
|
1710 | 942 | $ hg branch -q 'text.{rev}' |
|
1711 | 943 | $ echo aa >> aa |
|
1712 | 944 | $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped' |
|
1713 | 945 | |
|
1714 | $ hg log -l1 --template '{fill(desc, "20", author, branch)}' | |
|
1715 | {node|short}desc to | |
|
1716 | text.{rev}be wrapped | |
|
1717 | text.{rev}desc to be | |
|
1718 | text.{rev}wrapped (no-eol) | |
|
1719 | $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}' | |
|
1720 | bcc7ff960b8e:desc to | |
|
1721 | text.1:be wrapped | |
|
1722 | text.1:desc to be | |
|
1723 | text.1:wrapped (no-eol) | |
|
1724 | $ hg log -l1 -T '{fill(desc, date, "", "")}\n' | |
|
1725 | hg: parse error: fill expects an integer width | |
|
1726 | [255] | |
|
946 | Test termwidth: | |
|
1727 | 947 | |
|
1728 | 948 | $ COLUMNS=25 hg log -l1 --template '{fill(desc, termwidth, "{node|short}:", "termwidth.{rev}:")}' |
|
1729 | 949 | bcc7ff960b8e:desc to be |
|
1730 | 950 | termwidth.1:wrapped desc |
|
1731 | 951 | termwidth.1:to be wrapped (no-eol) |
|
1732 | 952 | |
|
1733 | $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}' | |
|
1734 | {node|short} (no-eol) | |
|
1735 | $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}' | |
|
1736 | bcc-ff---b-e (no-eol) | |
|
1737 | ||
|
1738 | $ cat >> .hg/hgrc <<EOF | |
|
1739 | > [extensions] | |
|
1740 | > color= | |
|
1741 | > [color] | |
|
1742 | > mode=ansi | |
|
1743 | > text.{rev} = red | |
|
1744 | > text.1 = green | |
|
1745 | > EOF | |
|
1746 | $ hg log --color=always -l 1 --template '{label(branch, "text\n")}' | |
|
1747 | \x1b[0;31mtext\x1b[0m (esc) | |
|
1748 | $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}' | |
|
1749 | \x1b[0;32mtext\x1b[0m (esc) | |
|
1750 | ||
|
1751 | 953 |
|
|
1752 | 954 | |
|
1753 | 955 |
|
@@ -1841,172 +1043,6 b' Test namespaces dict' | |||
|
1841 | 1043 | |
|
1842 | 1044 | $ cd .. |
|
1843 | 1045 | |
|
1844 | Test bad template with better error message | |
|
1845 | ||
|
1846 | $ hg log -Gv -R a --template '{desc|user()}' | |
|
1847 | hg: parse error: expected a symbol, got 'func' | |
|
1848 | [255] | |
|
1849 | ||
|
1850 | Test broken string escapes: | |
|
1851 | ||
|
1852 | $ hg log -T "bogus\\" -R a | |
|
1853 | hg: parse error: trailing \ in string | |
|
1854 | [255] | |
|
1855 | $ hg log -T "\\xy" -R a | |
|
1856 | hg: parse error: invalid \x escape* (glob) | |
|
1857 | [255] | |
|
1858 | ||
|
1859 | Templater supports aliases of symbol and func() styles: | |
|
1860 | ||
|
1861 | $ hg clone -q a aliases | |
|
1862 | $ cd aliases | |
|
1863 | $ cat <<EOF >> .hg/hgrc | |
|
1864 | > [templatealias] | |
|
1865 | > r = rev | |
|
1866 | > rn = "{r}:{node|short}" | |
|
1867 | > status(c, files) = files % "{c} {file}\n" | |
|
1868 | > utcdate(d) = localdate(d, "UTC") | |
|
1869 | > EOF | |
|
1870 | ||
|
1871 | $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n' | |
|
1872 | (template | |
|
1873 | (symbol 'rn') | |
|
1874 | (string ' ') | |
|
1875 | (| | |
|
1876 | (func | |
|
1877 | (symbol 'utcdate') | |
|
1878 | (symbol 'date')) | |
|
1879 | (symbol 'isodate')) | |
|
1880 | (string '\n')) | |
|
1881 | * expanded: | |
|
1882 | (template | |
|
1883 | (template | |
|
1884 | (symbol 'rev') | |
|
1885 | (string ':') | |
|
1886 | (| | |
|
1887 | (symbol 'node') | |
|
1888 | (symbol 'short'))) | |
|
1889 | (string ' ') | |
|
1890 | (| | |
|
1891 | (func | |
|
1892 | (symbol 'localdate') | |
|
1893 | (list | |
|
1894 | (symbol 'date') | |
|
1895 | (string 'UTC'))) | |
|
1896 | (symbol 'isodate')) | |
|
1897 | (string '\n')) | |
|
1898 | * keywords: date, node, rev | |
|
1899 | * functions: isodate, localdate, short | |
|
1900 | 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 | |
|
1901 | ||
|
1902 | $ hg debugtemplate -vr0 '{status("A", file_adds)}' | |
|
1903 | (template | |
|
1904 | (func | |
|
1905 | (symbol 'status') | |
|
1906 | (list | |
|
1907 | (string 'A') | |
|
1908 | (symbol 'file_adds')))) | |
|
1909 | * expanded: | |
|
1910 | (template | |
|
1911 | (% | |
|
1912 | (symbol 'file_adds') | |
|
1913 | (template | |
|
1914 | (string 'A') | |
|
1915 | (string ' ') | |
|
1916 | (symbol 'file') | |
|
1917 | (string '\n')))) | |
|
1918 | * keywords: file, file_adds | |
|
1919 | * functions: | |
|
1920 | A a | |
|
1921 | ||
|
1922 | A unary function alias can be called as a filter: | |
|
1923 | ||
|
1924 | $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n' | |
|
1925 | (template | |
|
1926 | (| | |
|
1927 | (| | |
|
1928 | (symbol 'date') | |
|
1929 | (symbol 'utcdate')) | |
|
1930 | (symbol 'isodate')) | |
|
1931 | (string '\n')) | |
|
1932 | * expanded: | |
|
1933 | (template | |
|
1934 | (| | |
|
1935 | (func | |
|
1936 | (symbol 'localdate') | |
|
1937 | (list | |
|
1938 | (symbol 'date') | |
|
1939 | (string 'UTC'))) | |
|
1940 | (symbol 'isodate')) | |
|
1941 | (string '\n')) | |
|
1942 | * keywords: date | |
|
1943 | * functions: isodate, localdate | |
|
1944 | 1970-01-12 13:46 +0000 | |
|
1945 | ||
|
1946 | Aliases should be applied only to command arguments and templates in hgrc. | |
|
1947 | Otherwise, our stock styles and web templates could be corrupted: | |
|
1948 | ||
|
1949 | $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n' | |
|
1950 | 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 | |
|
1951 | ||
|
1952 | $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"' | |
|
1953 | 0:1e4e1b8f71e0 1970-01-12 13:46 +0000 | |
|
1954 | ||
|
1955 | $ cat <<EOF > tmpl | |
|
1956 | > changeset = 'nothing expanded:{rn}\n' | |
|
1957 | > EOF | |
|
1958 | $ hg log -r0 --style ./tmpl | |
|
1959 | nothing expanded: | |
|
1960 | ||
|
1961 | Aliases in formatter: | |
|
1962 | ||
|
1963 | $ hg branches -T '{pad(branch, 7)} {rn}\n' | |
|
1964 | default 6:d41e714fe50d | |
|
1965 | foo 4:bbe44766e73d | |
|
1966 | ||
|
1967 | Aliases should honor HGPLAIN: | |
|
1968 | ||
|
1969 | $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n' | |
|
1970 | nothing expanded: | |
|
1971 | $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n' | |
|
1972 | 0:1e4e1b8f71e0 | |
|
1973 | ||
|
1974 | Unparsable alias: | |
|
1975 | ||
|
1976 | $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}' | |
|
1977 | (template | |
|
1978 | (symbol 'bad')) | |
|
1979 | abort: bad definition of template alias "bad": at 2: not a prefix: end | |
|
1980 | [255] | |
|
1981 | $ hg log --config templatealias.bad='x(' -T '{bad}' | |
|
1982 | abort: bad definition of template alias "bad": at 2: not a prefix: end | |
|
1983 | [255] | |
|
1984 | ||
|
1985 | $ cd .. | |
|
1986 | ||
|
1987 | Test that template function in extension is registered as expected | |
|
1988 | ||
|
1989 | $ cd a | |
|
1990 | ||
|
1991 | $ cat <<EOF > $TESTTMP/customfunc.py | |
|
1992 | > from mercurial import registrar | |
|
1993 | > | |
|
1994 | > templatefunc = registrar.templatefunc() | |
|
1995 | > | |
|
1996 | > @templatefunc(b'custom()') | |
|
1997 | > def custom(context, mapping, args): | |
|
1998 | > return b'custom' | |
|
1999 | > EOF | |
|
2000 | $ cat <<EOF > .hg/hgrc | |
|
2001 | > [extensions] | |
|
2002 | > customfunc = $TESTTMP/customfunc.py | |
|
2003 | > EOF | |
|
2004 | ||
|
2005 | $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true | |
|
2006 | custom | |
|
2007 | ||
|
2008 | $ cd .. | |
|
2009 | ||
|
2010 | 1046 | Test 'graphwidth' in 'hg log' on various topologies. The key here is that the |
|
2011 | 1047 | printed graphwidths 3, 5, 7, etc. should all line up in their respective |
|
2012 | 1048 | columns. We don't care about other aspects of the graph rendering here. |
@@ -2157,4 +1193,3 b' one column. The remaining columns are ad' | |||
|
2157 | 1193 | |
|
2158 | 1194 | |
|
2159 | 1195 | $ cd .. |
|
2160 |
General Comments 0
You need to be logged in to leave comments.
Login now