##// END OF EJS Templates
tests: extract test-template-map.t from test-command-template.t...
Yuya Nishihara -
r38452:ddce7bdf default
parent child Browse files
Show More
@@ -490,6 +490,7 b' test-symlinks.t'
490 490 test-tag.t
491 491 test-tags.t
492 492 test-template-filters.t
493 test-template-map.t
493 494 test-transplant.t
494 495 test-treemanifest.t
495 496 test-ui-color.py
This diff has been collapsed as it changes many lines, (1668 lines changed) Show them Hide them
@@ -245,1053 +245,6 b' Quoting for ui.logtemplate'
245 245 $ hg tip --config 'ui.logtemplate=n{rev}\n'
246 246 n8
247 247
248 Make sure user/global hgrc does not affect tests
249
250 $ echo '[ui]' > .hg/hgrc
251 $ echo 'logtemplate =' >> .hg/hgrc
252 $ echo 'style =' >> .hg/hgrc
253
254 Add some simple styles to settings
255
256 $ cat <<'EOF' >> .hg/hgrc
257 > [templates]
258 > simple = "{rev}\n"
259 > simple2 = {rev}\n
260 > rev = "should not precede {rev} keyword\n"
261 > EOF
262
263 $ hg log -l1 -Tsimple
264 8
265 $ hg log -l1 -Tsimple2
266 8
267 $ hg log -l1 -Trev
268 should not precede 8 keyword
269 $ hg log -l1 -T '{simple}'
270 8
271
272 Map file shouldn't see user templates:
273
274 $ cat <<EOF > tmpl
275 > changeset = 'nothing expanded:{simple}\n'
276 > EOF
277 $ hg log -l1 --style ./tmpl
278 nothing expanded:
279
280 Test templates and style maps in files:
281
282 $ echo "{rev}" > tmpl
283 $ hg log -l1 -T./tmpl
284 8
285 $ hg log -l1 -Tblah/blah
286 blah/blah (no-eol)
287
288 $ printf 'changeset = "{rev}\\n"\n' > map-simple
289 $ hg log -l1 -T./map-simple
290 8
291
292 a map file may have [templates] and [templatealias] sections:
293
294 $ cat <<'EOF' > map-simple
295 > [templates]
296 > changeset = "{a}\n"
297 > [templatealias]
298 > a = rev
299 > EOF
300 $ hg log -l1 -T./map-simple
301 8
302
303 so it can be included in hgrc
304
305 $ cat <<EOF > myhgrc
306 > %include $HGRCPATH
307 > %include map-simple
308 > [templates]
309 > foo = "{changeset}"
310 > EOF
311 $ HGRCPATH=./myhgrc hg log -l1 -Tfoo
312 8
313 $ HGRCPATH=./myhgrc hg log -l1 -T'{a}\n'
314 8
315
316 Test template map inheritance
317
318 $ echo "__base__ = map-cmdline.default" > map-simple
319 $ printf 'cset = "changeset: ***{rev}***\\n"\n' >> map-simple
320 $ hg log -l1 -T./map-simple
321 changeset: ***8***
322 tag: tip
323 user: test
324 date: Wed Jan 01 10:01:00 2020 +0000
325 summary: third
326
327
328 Test docheader, docfooter and separator in template map
329
330 $ cat <<'EOF' > map-myjson
331 > docheader = '\{\n'
332 > docfooter = '\n}\n'
333 > separator = ',\n'
334 > changeset = ' {dict(rev, node|short)|json}'
335 > EOF
336 $ hg log -l2 -T./map-myjson
337 {
338 {"node": "95c24699272e", "rev": 8},
339 {"node": "29114dbae42b", "rev": 7}
340 }
341
342 Test docheader, docfooter and separator in [templates] section
343
344 $ cat <<'EOF' >> .hg/hgrc
345 > [templates]
346 > myjson = ' {dict(rev, node|short)|json}'
347 > myjson:docheader = '\{\n'
348 > myjson:docfooter = '\n}\n'
349 > myjson:separator = ',\n'
350 > :docheader = 'should not be selected as a docheader for literal templates\n'
351 > EOF
352 $ hg log -l2 -Tmyjson
353 {
354 {"node": "95c24699272e", "rev": 8},
355 {"node": "29114dbae42b", "rev": 7}
356 }
357 $ hg log -l1 -T'{rev}\n'
358 8
359
360 Template should precede style option
361
362 $ hg log -l1 --style default -T '{rev}\n'
363 8
364
365 Add a commit with empty description, to ensure that the templates
366 below will omit the description line.
367
368 $ echo c >> c
369 $ hg add c
370 $ hg commit -qm ' '
371
372 Default style is like normal output. Phases style should be the same
373 as default style, except for extra phase lines.
374
375 $ hg log > log.out
376 $ hg log --style default > style.out
377 $ cmp log.out style.out || diff -u log.out style.out
378 $ hg log -T phases > phases.out
379 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
380 +phase: draft
381 +phase: draft
382 +phase: draft
383 +phase: draft
384 +phase: draft
385 +phase: draft
386 +phase: draft
387 +phase: draft
388 +phase: draft
389 +phase: draft
390
391 $ hg log -v > log.out
392 $ hg log -v --style default > style.out
393 $ cmp log.out style.out || diff -u log.out style.out
394 $ hg log -v -T phases > phases.out
395 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
396 +phase: draft
397 +phase: draft
398 +phase: draft
399 +phase: draft
400 +phase: draft
401 +phase: draft
402 +phase: draft
403 +phase: draft
404 +phase: draft
405 +phase: draft
406
407 $ hg log -q > log.out
408 $ hg log -q --style default > style.out
409 $ cmp log.out style.out || diff -u log.out style.out
410 $ hg log -q -T phases > phases.out
411 $ cmp log.out phases.out || diff -u log.out phases.out
412
413 $ hg log --debug > log.out
414 $ hg log --debug --style default > style.out
415 $ cmp log.out style.out || diff -u log.out style.out
416 $ hg log --debug -T phases > phases.out
417 $ cmp log.out phases.out || diff -u log.out phases.out
418
419 Default style of working-directory revision should also be the same (but
420 date may change while running tests):
421
422 $ hg log -r 'wdir()' | sed 's|^date:.*|date:|' > log.out
423 $ hg log -r 'wdir()' --style default | sed 's|^date:.*|date:|' > style.out
424 $ cmp log.out style.out || diff -u log.out style.out
425
426 $ hg log -r 'wdir()' -v | sed 's|^date:.*|date:|' > log.out
427 $ hg log -r 'wdir()' -v --style default | sed 's|^date:.*|date:|' > style.out
428 $ cmp log.out style.out || diff -u log.out style.out
429
430 $ hg log -r 'wdir()' -q > log.out
431 $ hg log -r 'wdir()' -q --style default > style.out
432 $ cmp log.out style.out || diff -u log.out style.out
433
434 $ hg log -r 'wdir()' --debug | sed 's|^date:.*|date:|' > log.out
435 $ hg log -r 'wdir()' --debug --style default \
436 > | sed 's|^date:.*|date:|' > style.out
437 $ cmp log.out style.out || diff -u log.out style.out
438
439 Default style should also preserve color information (issue2866):
440
441 $ cp $HGRCPATH $HGRCPATH-bak
442 $ cat <<EOF >> $HGRCPATH
443 > [extensions]
444 > color=
445 > EOF
446
447 $ hg --color=debug log > log.out
448 $ hg --color=debug log --style default > style.out
449 $ cmp log.out style.out || diff -u log.out style.out
450 $ hg --color=debug log -T phases > phases.out
451 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
452 +[log.phase|phase: draft]
453 +[log.phase|phase: draft]
454 +[log.phase|phase: draft]
455 +[log.phase|phase: draft]
456 +[log.phase|phase: draft]
457 +[log.phase|phase: draft]
458 +[log.phase|phase: draft]
459 +[log.phase|phase: draft]
460 +[log.phase|phase: draft]
461 +[log.phase|phase: draft]
462
463 $ hg --color=debug -v log > log.out
464 $ hg --color=debug -v log --style default > style.out
465 $ cmp log.out style.out || diff -u log.out style.out
466 $ hg --color=debug -v log -T phases > phases.out
467 $ diff -U 0 log.out phases.out | egrep -v '^---|^\+\+\+|^@@'
468 +[log.phase|phase: draft]
469 +[log.phase|phase: draft]
470 +[log.phase|phase: draft]
471 +[log.phase|phase: draft]
472 +[log.phase|phase: draft]
473 +[log.phase|phase: draft]
474 +[log.phase|phase: draft]
475 +[log.phase|phase: draft]
476 +[log.phase|phase: draft]
477 +[log.phase|phase: draft]
478
479 $ hg --color=debug -q log > log.out
480 $ hg --color=debug -q log --style default > style.out
481 $ cmp log.out style.out || diff -u log.out style.out
482 $ hg --color=debug -q log -T phases > phases.out
483 $ cmp log.out phases.out || diff -u log.out phases.out
484
485 $ hg --color=debug --debug log > log.out
486 $ hg --color=debug --debug log --style default > style.out
487 $ cmp log.out style.out || diff -u log.out style.out
488 $ hg --color=debug --debug log -T phases > phases.out
489 $ cmp log.out phases.out || diff -u log.out phases.out
490
491 $ mv $HGRCPATH-bak $HGRCPATH
492
493 Remove commit with empty commit message, so as to not pollute further
494 tests.
495
496 $ hg --config extensions.strip= strip -q .
497
498 Revision with no copies (used to print a traceback):
499
500 $ hg tip -v --template '\n'
501
502
503 Compact style works:
504
505 $ hg log -Tcompact
506 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
507 third
508
509 7:-1 29114dbae42b 1970-01-12 13:46 +0000 user
510 second
511
512 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
513 merge
514
515 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
516 new head
517
518 4 bbe44766e73d 1970-01-17 04:53 +0000 person
519 new branch
520
521 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
522 no user, no domain
523
524 2 97054abb4ab8 1970-01-14 21:20 +0000 other
525 no person
526
527 1 b608e9d1a3f0 1970-01-13 17:33 +0000 other
528 other 1
529
530 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 user
531 line 1
532
533
534 $ hg log -v --style compact
535 8[tip] 95c24699272e 2020-01-01 10:01 +0000 test
536 third
537
538 7:-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
539 second
540
541 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
542 merge
543
544 5:3 13207e5a10d9 1970-01-18 08:40 +0000 person
545 new head
546
547 4 bbe44766e73d 1970-01-17 04:53 +0000 person
548 new branch
549
550 3 10e46f2dcbf4 1970-01-16 01:06 +0000 person
551 no user, no domain
552
553 2 97054abb4ab8 1970-01-14 21:20 +0000 other@place
554 no person
555
556 1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
557 other 1
558 other 2
559
560 other 3
561
562 0 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
563 line 1
564 line 2
565
566
567 $ hg log --debug --style compact
568 8[tip]:7,-1 95c24699272e 2020-01-01 10:01 +0000 test
569 third
570
571 7:-1,-1 29114dbae42b 1970-01-12 13:46 +0000 User Name <user@hostname>
572 second
573
574 6:5,4 d41e714fe50d 1970-01-18 08:40 +0000 person
575 merge
576
577 5:3,-1 13207e5a10d9 1970-01-18 08:40 +0000 person
578 new head
579
580 4:3,-1 bbe44766e73d 1970-01-17 04:53 +0000 person
581 new branch
582
583 3:2,-1 10e46f2dcbf4 1970-01-16 01:06 +0000 person
584 no user, no domain
585
586 2:1,-1 97054abb4ab8 1970-01-14 21:20 +0000 other@place
587 no person
588
589 1:0,-1 b608e9d1a3f0 1970-01-13 17:33 +0000 A. N. Other <other@place>
590 other 1
591 other 2
592
593 other 3
594
595 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:46 +0000 User Name <user@hostname>
596 line 1
597 line 2
598
599
600 Test xml styles:
601
602 $ hg log --style xml -r 'not all()'
603 <?xml version="1.0"?>
604 <log>
605 </log>
606
607 $ hg log --style xml
608 <?xml version="1.0"?>
609 <log>
610 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
611 <tag>tip</tag>
612 <author email="test">test</author>
613 <date>2020-01-01T10:01:00+00:00</date>
614 <msg xml:space="preserve">third</msg>
615 </logentry>
616 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
617 <parent revision="-1" node="0000000000000000000000000000000000000000" />
618 <author email="user@hostname">User Name</author>
619 <date>1970-01-12T13:46:40+00:00</date>
620 <msg xml:space="preserve">second</msg>
621 </logentry>
622 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
623 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
624 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
625 <author email="person">person</author>
626 <date>1970-01-18T08:40:01+00:00</date>
627 <msg xml:space="preserve">merge</msg>
628 </logentry>
629 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
630 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
631 <author email="person">person</author>
632 <date>1970-01-18T08:40:00+00:00</date>
633 <msg xml:space="preserve">new head</msg>
634 </logentry>
635 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
636 <branch>foo</branch>
637 <author email="person">person</author>
638 <date>1970-01-17T04:53:20+00:00</date>
639 <msg xml:space="preserve">new branch</msg>
640 </logentry>
641 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
642 <author email="person">person</author>
643 <date>1970-01-16T01:06:40+00:00</date>
644 <msg xml:space="preserve">no user, no domain</msg>
645 </logentry>
646 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
647 <author email="other@place">other</author>
648 <date>1970-01-14T21:20:00+00:00</date>
649 <msg xml:space="preserve">no person</msg>
650 </logentry>
651 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
652 <author email="other@place">A. N. Other</author>
653 <date>1970-01-13T17:33:20+00:00</date>
654 <msg xml:space="preserve">other 1
655 other 2
656
657 other 3</msg>
658 </logentry>
659 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
660 <author email="user@hostname">User Name</author>
661 <date>1970-01-12T13:46:40+00:00</date>
662 <msg xml:space="preserve">line 1
663 line 2</msg>
664 </logentry>
665 </log>
666
667 $ hg log -v --style xml
668 <?xml version="1.0"?>
669 <log>
670 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
671 <tag>tip</tag>
672 <author email="test">test</author>
673 <date>2020-01-01T10:01:00+00:00</date>
674 <msg xml:space="preserve">third</msg>
675 <paths>
676 <path action="A">fourth</path>
677 <path action="A">third</path>
678 <path action="R">second</path>
679 </paths>
680 <copies>
681 <copy source="second">fourth</copy>
682 </copies>
683 </logentry>
684 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
685 <parent revision="-1" node="0000000000000000000000000000000000000000" />
686 <author email="user@hostname">User Name</author>
687 <date>1970-01-12T13:46:40+00:00</date>
688 <msg xml:space="preserve">second</msg>
689 <paths>
690 <path action="A">second</path>
691 </paths>
692 </logentry>
693 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
694 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
695 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
696 <author email="person">person</author>
697 <date>1970-01-18T08:40:01+00:00</date>
698 <msg xml:space="preserve">merge</msg>
699 <paths>
700 </paths>
701 </logentry>
702 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
703 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
704 <author email="person">person</author>
705 <date>1970-01-18T08:40:00+00:00</date>
706 <msg xml:space="preserve">new head</msg>
707 <paths>
708 <path action="A">d</path>
709 </paths>
710 </logentry>
711 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
712 <branch>foo</branch>
713 <author email="person">person</author>
714 <date>1970-01-17T04:53:20+00:00</date>
715 <msg xml:space="preserve">new branch</msg>
716 <paths>
717 </paths>
718 </logentry>
719 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
720 <author email="person">person</author>
721 <date>1970-01-16T01:06:40+00:00</date>
722 <msg xml:space="preserve">no user, no domain</msg>
723 <paths>
724 <path action="M">c</path>
725 </paths>
726 </logentry>
727 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
728 <author email="other@place">other</author>
729 <date>1970-01-14T21:20:00+00:00</date>
730 <msg xml:space="preserve">no person</msg>
731 <paths>
732 <path action="A">c</path>
733 </paths>
734 </logentry>
735 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
736 <author email="other@place">A. N. Other</author>
737 <date>1970-01-13T17:33:20+00:00</date>
738 <msg xml:space="preserve">other 1
739 other 2
740
741 other 3</msg>
742 <paths>
743 <path action="A">b</path>
744 </paths>
745 </logentry>
746 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
747 <author email="user@hostname">User Name</author>
748 <date>1970-01-12T13:46:40+00:00</date>
749 <msg xml:space="preserve">line 1
750 line 2</msg>
751 <paths>
752 <path action="A">a</path>
753 </paths>
754 </logentry>
755 </log>
756
757 $ hg log --debug --style xml
758 <?xml version="1.0"?>
759 <log>
760 <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
761 <tag>tip</tag>
762 <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
763 <parent revision="-1" node="0000000000000000000000000000000000000000" />
764 <author email="test">test</author>
765 <date>2020-01-01T10:01:00+00:00</date>
766 <msg xml:space="preserve">third</msg>
767 <paths>
768 <path action="A">fourth</path>
769 <path action="A">third</path>
770 <path action="R">second</path>
771 </paths>
772 <copies>
773 <copy source="second">fourth</copy>
774 </copies>
775 <extra key="branch">default</extra>
776 </logentry>
777 <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
778 <parent revision="-1" node="0000000000000000000000000000000000000000" />
779 <parent revision="-1" node="0000000000000000000000000000000000000000" />
780 <author email="user@hostname">User Name</author>
781 <date>1970-01-12T13:46:40+00:00</date>
782 <msg xml:space="preserve">second</msg>
783 <paths>
784 <path action="A">second</path>
785 </paths>
786 <extra key="branch">default</extra>
787 </logentry>
788 <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
789 <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
790 <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
791 <author email="person">person</author>
792 <date>1970-01-18T08:40:01+00:00</date>
793 <msg xml:space="preserve">merge</msg>
794 <paths>
795 </paths>
796 <extra key="branch">default</extra>
797 </logentry>
798 <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
799 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
800 <parent revision="-1" node="0000000000000000000000000000000000000000" />
801 <author email="person">person</author>
802 <date>1970-01-18T08:40:00+00:00</date>
803 <msg xml:space="preserve">new head</msg>
804 <paths>
805 <path action="A">d</path>
806 </paths>
807 <extra key="branch">default</extra>
808 </logentry>
809 <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
810 <branch>foo</branch>
811 <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
812 <parent revision="-1" node="0000000000000000000000000000000000000000" />
813 <author email="person">person</author>
814 <date>1970-01-17T04:53:20+00:00</date>
815 <msg xml:space="preserve">new branch</msg>
816 <paths>
817 </paths>
818 <extra key="branch">foo</extra>
819 </logentry>
820 <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
821 <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
822 <parent revision="-1" node="0000000000000000000000000000000000000000" />
823 <author email="person">person</author>
824 <date>1970-01-16T01:06:40+00:00</date>
825 <msg xml:space="preserve">no user, no domain</msg>
826 <paths>
827 <path action="M">c</path>
828 </paths>
829 <extra key="branch">default</extra>
830 </logentry>
831 <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
832 <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
833 <parent revision="-1" node="0000000000000000000000000000000000000000" />
834 <author email="other@place">other</author>
835 <date>1970-01-14T21:20:00+00:00</date>
836 <msg xml:space="preserve">no person</msg>
837 <paths>
838 <path action="A">c</path>
839 </paths>
840 <extra key="branch">default</extra>
841 </logentry>
842 <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
843 <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
844 <parent revision="-1" node="0000000000000000000000000000000000000000" />
845 <author email="other@place">A. N. Other</author>
846 <date>1970-01-13T17:33:20+00:00</date>
847 <msg xml:space="preserve">other 1
848 other 2
849
850 other 3</msg>
851 <paths>
852 <path action="A">b</path>
853 </paths>
854 <extra key="branch">default</extra>
855 </logentry>
856 <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
857 <parent revision="-1" node="0000000000000000000000000000000000000000" />
858 <parent revision="-1" node="0000000000000000000000000000000000000000" />
859 <author email="user@hostname">User Name</author>
860 <date>1970-01-12T13:46:40+00:00</date>
861 <msg xml:space="preserve">line 1
862 line 2</msg>
863 <paths>
864 <path action="A">a</path>
865 </paths>
866 <extra key="branch">default</extra>
867 </logentry>
868 </log>
869
870
871 Test JSON style:
872
873 $ hg log -k nosuch -Tjson
874 [
875 ]
876
877 $ hg log -qr . -Tjson
878 [
879 {
880 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
881 "rev": 8
882 }
883 ]
884
885 $ hg log -vpr . -Tjson --stat
886 [
887 {
888 "bookmarks": [],
889 "branch": "default",
890 "date": [1577872860, 0],
891 "desc": "third",
892 "diff": "diff -r 29114dbae42b -r 95c24699272e fourth\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/fourth\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+second\ndiff -r 29114dbae42b -r 95c24699272e second\n--- a/second\tMon Jan 12 13:46:40 1970 +0000\n+++ /dev/null\tThu Jan 01 00:00:00 1970 +0000\n@@ -1,1 +0,0 @@\n-second\ndiff -r 29114dbae42b -r 95c24699272e third\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/third\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+third\n",
893 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
894 "files": ["fourth", "second", "third"],
895 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
896 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
897 "phase": "draft",
898 "rev": 8,
899 "tags": ["tip"],
900 "user": "test"
901 }
902 ]
903
904 honor --git but not format-breaking diffopts
905 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
906 [
907 {
908 "bookmarks": [],
909 "branch": "default",
910 "date": [1577872860, 0],
911 "desc": "third",
912 "diff": "diff --git a/second b/fourth\nrename from second\nrename to fourth\ndiff --git a/third b/third\nnew file mode 100644\n--- /dev/null\n+++ b/third\n@@ -0,0 +1,1 @@\n+third\n",
913 "files": ["fourth", "second", "third"],
914 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
915 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
916 "phase": "draft",
917 "rev": 8,
918 "tags": ["tip"],
919 "user": "test"
920 }
921 ]
922
923 $ hg log -T json
924 [
925 {
926 "bookmarks": [],
927 "branch": "default",
928 "date": [1577872860, 0],
929 "desc": "third",
930 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
931 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
932 "phase": "draft",
933 "rev": 8,
934 "tags": ["tip"],
935 "user": "test"
936 },
937 {
938 "bookmarks": [],
939 "branch": "default",
940 "date": [1000000, 0],
941 "desc": "second",
942 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
943 "parents": ["0000000000000000000000000000000000000000"],
944 "phase": "draft",
945 "rev": 7,
946 "tags": [],
947 "user": "User Name <user@hostname>"
948 },
949 {
950 "bookmarks": [],
951 "branch": "default",
952 "date": [1500001, 0],
953 "desc": "merge",
954 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
955 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
956 "phase": "draft",
957 "rev": 6,
958 "tags": [],
959 "user": "person"
960 },
961 {
962 "bookmarks": [],
963 "branch": "default",
964 "date": [1500000, 0],
965 "desc": "new head",
966 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
967 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
968 "phase": "draft",
969 "rev": 5,
970 "tags": [],
971 "user": "person"
972 },
973 {
974 "bookmarks": [],
975 "branch": "foo",
976 "date": [1400000, 0],
977 "desc": "new branch",
978 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
979 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
980 "phase": "draft",
981 "rev": 4,
982 "tags": [],
983 "user": "person"
984 },
985 {
986 "bookmarks": [],
987 "branch": "default",
988 "date": [1300000, 0],
989 "desc": "no user, no domain",
990 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
991 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
992 "phase": "draft",
993 "rev": 3,
994 "tags": [],
995 "user": "person"
996 },
997 {
998 "bookmarks": [],
999 "branch": "default",
1000 "date": [1200000, 0],
1001 "desc": "no person",
1002 "node": "97054abb4ab824450e9164180baf491ae0078465",
1003 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1004 "phase": "draft",
1005 "rev": 2,
1006 "tags": [],
1007 "user": "other@place"
1008 },
1009 {
1010 "bookmarks": [],
1011 "branch": "default",
1012 "date": [1100000, 0],
1013 "desc": "other 1\nother 2\n\nother 3",
1014 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1015 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1016 "phase": "draft",
1017 "rev": 1,
1018 "tags": [],
1019 "user": "A. N. Other <other@place>"
1020 },
1021 {
1022 "bookmarks": [],
1023 "branch": "default",
1024 "date": [1000000, 0],
1025 "desc": "line 1\nline 2",
1026 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1027 "parents": ["0000000000000000000000000000000000000000"],
1028 "phase": "draft",
1029 "rev": 0,
1030 "tags": [],
1031 "user": "User Name <user@hostname>"
1032 }
1033 ]
1034
1035 $ hg heads -v -Tjson
1036 [
1037 {
1038 "bookmarks": [],
1039 "branch": "default",
1040 "date": [1577872860, 0],
1041 "desc": "third",
1042 "files": ["fourth", "second", "third"],
1043 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1044 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1045 "phase": "draft",
1046 "rev": 8,
1047 "tags": ["tip"],
1048 "user": "test"
1049 },
1050 {
1051 "bookmarks": [],
1052 "branch": "default",
1053 "date": [1500001, 0],
1054 "desc": "merge",
1055 "files": [],
1056 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1057 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1058 "phase": "draft",
1059 "rev": 6,
1060 "tags": [],
1061 "user": "person"
1062 },
1063 {
1064 "bookmarks": [],
1065 "branch": "foo",
1066 "date": [1400000, 0],
1067 "desc": "new branch",
1068 "files": [],
1069 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1070 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1071 "phase": "draft",
1072 "rev": 4,
1073 "tags": [],
1074 "user": "person"
1075 }
1076 ]
1077
1078 $ hg log --debug -Tjson
1079 [
1080 {
1081 "added": ["fourth", "third"],
1082 "bookmarks": [],
1083 "branch": "default",
1084 "date": [1577872860, 0],
1085 "desc": "third",
1086 "extra": {"branch": "default"},
1087 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
1088 "modified": [],
1089 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1090 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1091 "phase": "draft",
1092 "removed": ["second"],
1093 "rev": 8,
1094 "tags": ["tip"],
1095 "user": "test"
1096 },
1097 {
1098 "added": ["second"],
1099 "bookmarks": [],
1100 "branch": "default",
1101 "date": [1000000, 0],
1102 "desc": "second",
1103 "extra": {"branch": "default"},
1104 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
1105 "modified": [],
1106 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
1107 "parents": ["0000000000000000000000000000000000000000"],
1108 "phase": "draft",
1109 "removed": [],
1110 "rev": 7,
1111 "tags": [],
1112 "user": "User Name <user@hostname>"
1113 },
1114 {
1115 "added": [],
1116 "bookmarks": [],
1117 "branch": "default",
1118 "date": [1500001, 0],
1119 "desc": "merge",
1120 "extra": {"branch": "default"},
1121 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1122 "modified": [],
1123 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1124 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1125 "phase": "draft",
1126 "removed": [],
1127 "rev": 6,
1128 "tags": [],
1129 "user": "person"
1130 },
1131 {
1132 "added": ["d"],
1133 "bookmarks": [],
1134 "branch": "default",
1135 "date": [1500000, 0],
1136 "desc": "new head",
1137 "extra": {"branch": "default"},
1138 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1139 "modified": [],
1140 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
1141 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1142 "phase": "draft",
1143 "removed": [],
1144 "rev": 5,
1145 "tags": [],
1146 "user": "person"
1147 },
1148 {
1149 "added": [],
1150 "bookmarks": [],
1151 "branch": "foo",
1152 "date": [1400000, 0],
1153 "desc": "new branch",
1154 "extra": {"branch": "foo"},
1155 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1156 "modified": [],
1157 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1158 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1159 "phase": "draft",
1160 "removed": [],
1161 "rev": 4,
1162 "tags": [],
1163 "user": "person"
1164 },
1165 {
1166 "added": [],
1167 "bookmarks": [],
1168 "branch": "default",
1169 "date": [1300000, 0],
1170 "desc": "no user, no domain",
1171 "extra": {"branch": "default"},
1172 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1173 "modified": ["c"],
1174 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
1175 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
1176 "phase": "draft",
1177 "removed": [],
1178 "rev": 3,
1179 "tags": [],
1180 "user": "person"
1181 },
1182 {
1183 "added": ["c"],
1184 "bookmarks": [],
1185 "branch": "default",
1186 "date": [1200000, 0],
1187 "desc": "no person",
1188 "extra": {"branch": "default"},
1189 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
1190 "modified": [],
1191 "node": "97054abb4ab824450e9164180baf491ae0078465",
1192 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1193 "phase": "draft",
1194 "removed": [],
1195 "rev": 2,
1196 "tags": [],
1197 "user": "other@place"
1198 },
1199 {
1200 "added": ["b"],
1201 "bookmarks": [],
1202 "branch": "default",
1203 "date": [1100000, 0],
1204 "desc": "other 1\nother 2\n\nother 3",
1205 "extra": {"branch": "default"},
1206 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
1207 "modified": [],
1208 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1209 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1210 "phase": "draft",
1211 "removed": [],
1212 "rev": 1,
1213 "tags": [],
1214 "user": "A. N. Other <other@place>"
1215 },
1216 {
1217 "added": ["a"],
1218 "bookmarks": [],
1219 "branch": "default",
1220 "date": [1000000, 0],
1221 "desc": "line 1\nline 2",
1222 "extra": {"branch": "default"},
1223 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
1224 "modified": [],
1225 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1226 "parents": ["0000000000000000000000000000000000000000"],
1227 "phase": "draft",
1228 "removed": [],
1229 "rev": 0,
1230 "tags": [],
1231 "user": "User Name <user@hostname>"
1232 }
1233 ]
1234
1235 Error if style not readable:
1236
1237 #if unix-permissions no-root
1238 $ touch q
1239 $ chmod 0 q
1240 $ hg log --style ./q
1241 abort: Permission denied: ./q
1242 [255]
1243 #endif
1244
1245 Error if no style:
1246
1247 $ hg log --style notexist
1248 abort: style 'notexist' not found
1249 (available styles: bisect, changelog, compact, default, phases, show, status, xml)
1250 [255]
1251
1252 $ hg log -T list
1253 available styles: bisect, changelog, compact, default, phases, show, status, xml
1254 abort: specify a template
1255 [255]
1256
1257 Error if style missing key:
1258
1259 $ echo 'q = q' > t
1260 $ hg log --style ./t
1261 abort: "changeset" not in template map
1262 [255]
1263
1264 Error if style missing value:
1265
1266 $ echo 'changeset =' > t
1267 $ hg log --style t
1268 hg: parse error at t:1: missing value
1269 [255]
1270
1271 Error if include fails:
1272
1273 $ echo 'changeset = q' >> t
1274 #if unix-permissions no-root
1275 $ hg log --style ./t
1276 abort: template file ./q: Permission denied
1277 [255]
1278 $ rm -f q
1279 #endif
1280
1281 Include works:
1282
1283 $ echo '{rev}' > q
1284 $ hg log --style ./t
1285 8
1286 7
1287 6
1288 5
1289 4
1290 3
1291 2
1292 1
1293 0
1294
1295 248 Check that recursive reference does not fall into RuntimeError (issue4758):
1296 249
1297 250 common mistake:
@@ -1359,122 +312,6 b' Check that {phase} works correctly on pa'
1359 312 o 0 (public): -1 (public) -1 (public)
1360 313
1361 314
1362 Missing non-standard names give no error (backward compatibility):
1363
1364 $ echo "changeset = '{c}'" > t
1365 $ hg log --style ./t
1366
1367 Defining non-standard name works:
1368
1369 $ cat <<EOF > t
1370 > changeset = '{c}'
1371 > c = q
1372 > EOF
1373 $ hg log --style ./t
1374 8
1375 7
1376 6
1377 5
1378 4
1379 3
1380 2
1381 1
1382 0
1383
1384 ui.style works:
1385
1386 $ echo '[ui]' > .hg/hgrc
1387 $ echo 'style = t' >> .hg/hgrc
1388 $ hg log
1389 8
1390 7
1391 6
1392 5
1393 4
1394 3
1395 2
1396 1
1397 0
1398
1399
1400 Issue338:
1401
1402 $ hg log --style=changelog > changelog
1403
1404 $ cat changelog
1405 2020-01-01 test <test>
1406
1407 * fourth, second, third:
1408 third
1409 [95c24699272e] [tip]
1410
1411 1970-01-12 User Name <user@hostname>
1412
1413 * second:
1414 second
1415 [29114dbae42b]
1416
1417 1970-01-18 person <person>
1418
1419 * merge
1420 [d41e714fe50d]
1421
1422 * d:
1423 new head
1424 [13207e5a10d9]
1425
1426 1970-01-17 person <person>
1427
1428 * new branch
1429 [bbe44766e73d] <foo>
1430
1431 1970-01-16 person <person>
1432
1433 * c:
1434 no user, no domain
1435 [10e46f2dcbf4]
1436
1437 1970-01-14 other <other@place>
1438
1439 * c:
1440 no person
1441 [97054abb4ab8]
1442
1443 1970-01-13 A. N. Other <other@place>
1444
1445 * b:
1446 other 1 other 2
1447
1448 other 3
1449 [b608e9d1a3f0]
1450
1451 1970-01-12 User Name <user@hostname>
1452
1453 * a:
1454 line 1 line 2
1455 [1e4e1b8f71e0]
1456
1457
1458 Issue2130: xml output for 'hg heads' is malformed
1459
1460 $ hg heads --style changelog
1461 2020-01-01 test <test>
1462
1463 * fourth, second, third:
1464 third
1465 [95c24699272e] [tip]
1466
1467 1970-01-18 person <person>
1468
1469 * merge
1470 [d41e714fe50d]
1471
1472 1970-01-17 person <person>
1473
1474 * new branch
1475 [bbe44766e73d] <foo>
1476
1477
1478 315 Keys work:
1479 316
1480 317 $ for key in author branch branches date desc file_adds file_dels file_mods \
@@ -2320,470 +1157,15 b' Add a commit that does all possible modi'
2320 1157 $ hg rm a
2321 1158 $ hg ci -m "Modify, add, remove, rename"
2322 1159
2323 Check the status template
2324
2325 $ cat <<EOF >> $HGRCPATH
2326 > [extensions]
2327 > color=
1160 Error on syntax:
1161
1162 $ cat <<EOF > t
1163 > changeset = '{c}'
1164 > c = q
1165 > x = "f
2328 1166 > EOF
2329
2330 $ hg log -T status -r 10
2331 changeset: 10:0f9759ec227a
2332 tag: tip
2333 user: test
2334 date: Thu Jan 01 00:00:00 1970 +0000
2335 summary: Modify, add, remove, rename
2336 files:
2337 M third
2338 A b
2339 A fifth
2340 R a
2341 R fourth
2342
2343 $ hg log -T status -C -r 10
2344 changeset: 10:0f9759ec227a
2345 tag: tip
2346 user: test
2347 date: Thu Jan 01 00:00:00 1970 +0000
2348 summary: Modify, add, remove, rename
2349 files:
2350 M third
2351 A b
2352 A fifth
2353 fourth
2354 R a
2355 R fourth
2356
2357 $ hg log -T status -C -r 10 -v
2358 changeset: 10:0f9759ec227a
2359 tag: tip
2360 user: test
2361 date: Thu Jan 01 00:00:00 1970 +0000
2362 description:
2363 Modify, add, remove, rename
2364
2365 files:
2366 M third
2367 A b
2368 A fifth
2369 fourth
2370 R a
2371 R fourth
2372
2373 $ hg log -T status -C -r 10 --debug
2374 changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c
2375 tag: tip
2376 phase: secret
2377 parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066
2378 parent: -1:0000000000000000000000000000000000000000
2379 manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567
2380 user: test
2381 date: Thu Jan 01 00:00:00 1970 +0000
2382 extra: branch=default
2383 description:
2384 Modify, add, remove, rename
2385
2386 files:
2387 M third
2388 A b
2389 A fifth
2390 fourth
2391 R a
2392 R fourth
2393
2394 $ hg log -T status -C -r 10 --quiet
2395 10:0f9759ec227a
2396 $ hg --color=debug log -T status -r 10
2397 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2398 [log.tag|tag: tip]
2399 [log.user|user: test]
2400 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2401 [log.summary|summary: Modify, add, remove, rename]
2402 [ui.note log.files|files:]
2403 [status.modified|M third]
2404 [status.added|A b]
2405 [status.added|A fifth]
2406 [status.removed|R a]
2407 [status.removed|R fourth]
2408
2409 $ hg --color=debug log -T status -C -r 10
2410 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2411 [log.tag|tag: tip]
2412 [log.user|user: test]
2413 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2414 [log.summary|summary: Modify, add, remove, rename]
2415 [ui.note log.files|files:]
2416 [status.modified|M third]
2417 [status.added|A b]
2418 [status.added|A fifth]
2419 [status.copied| fourth]
2420 [status.removed|R a]
2421 [status.removed|R fourth]
2422
2423 $ hg --color=debug log -T status -C -r 10 -v
2424 [log.changeset changeset.secret|changeset: 10:0f9759ec227a]
2425 [log.tag|tag: tip]
2426 [log.user|user: test]
2427 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2428 [ui.note log.description|description:]
2429 [ui.note log.description|Modify, add, remove, rename]
2430
2431 [ui.note log.files|files:]
2432 [status.modified|M third]
2433 [status.added|A b]
2434 [status.added|A fifth]
2435 [status.copied| fourth]
2436 [status.removed|R a]
2437 [status.removed|R fourth]
2438
2439 $ hg --color=debug log -T status -C -r 10 --debug
2440 [log.changeset changeset.secret|changeset: 10:0f9759ec227a4859c2014a345cd8a859022b7c6c]
2441 [log.tag|tag: tip]
2442 [log.phase|phase: secret]
2443 [log.parent changeset.secret|parent: 9:bf9dfba36635106d6a73ccc01e28b762da60e066]
2444 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2445 [ui.debug log.manifest|manifest: 8:89dd546f2de0a9d6d664f58d86097eb97baba567]
2446 [log.user|user: test]
2447 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
2448 [ui.debug log.extra|extra: branch=default]
2449 [ui.note log.description|description:]
2450 [ui.note log.description|Modify, add, remove, rename]
2451
2452 [ui.note log.files|files:]
2453 [status.modified|M third]
2454 [status.added|A b]
2455 [status.added|A fifth]
2456 [status.copied| fourth]
2457 [status.removed|R a]
2458 [status.removed|R fourth]
2459
2460 $ hg --color=debug log -T status -C -r 10 --quiet
2461 [log.node|10:0f9759ec227a]
2462
2463 Check the bisect template
2464
2465 $ hg bisect -g 1
2466 $ hg bisect -b 3 --noupdate
2467 Testing changeset 2:97054abb4ab8 (2 changesets remaining, ~1 tests)
2468 $ hg log -T bisect -r 0:4
2469 changeset: 0:1e4e1b8f71e0
2470 bisect: good (implicit)
2471 user: User Name <user@hostname>
2472 date: Mon Jan 12 13:46:40 1970 +0000
2473 summary: line 1
2474
2475 changeset: 1:b608e9d1a3f0
2476 bisect: good
2477 user: A. N. Other <other@place>
2478 date: Tue Jan 13 17:33:20 1970 +0000
2479 summary: other 1
2480
2481 changeset: 2:97054abb4ab8
2482 bisect: untested
2483 user: other@place
2484 date: Wed Jan 14 21:20:00 1970 +0000
2485 summary: no person
2486
2487 changeset: 3:10e46f2dcbf4
2488 bisect: bad
2489 user: person
2490 date: Fri Jan 16 01:06:40 1970 +0000
2491 summary: no user, no domain
2492
2493 changeset: 4:bbe44766e73d
2494 bisect: bad (implicit)
2495 branch: foo
2496 user: person
2497 date: Sat Jan 17 04:53:20 1970 +0000
2498 summary: new branch
2499
2500 $ hg log --debug -T bisect -r 0:4
2501 changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2502 bisect: good (implicit)
2503 phase: public
2504 parent: -1:0000000000000000000000000000000000000000
2505 parent: -1:0000000000000000000000000000000000000000
2506 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
2507 user: User Name <user@hostname>
2508 date: Mon Jan 12 13:46:40 1970 +0000
2509 files+: a
2510 extra: branch=default
2511 description:
2512 line 1
2513 line 2
2514
2515
2516 changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2517 bisect: good
2518 phase: public
2519 parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f
2520 parent: -1:0000000000000000000000000000000000000000
2521 manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
2522 user: A. N. Other <other@place>
2523 date: Tue Jan 13 17:33:20 1970 +0000
2524 files+: b
2525 extra: branch=default
2526 description:
2527 other 1
2528 other 2
2529
2530 other 3
2531
2532
2533 changeset: 2:97054abb4ab824450e9164180baf491ae0078465
2534 bisect: untested
2535 phase: public
2536 parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2537 parent: -1:0000000000000000000000000000000000000000
2538 manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
2539 user: other@place
2540 date: Wed Jan 14 21:20:00 1970 +0000
2541 files+: c
2542 extra: branch=default
2543 description:
2544 no person
2545
2546
2547 changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2548 bisect: bad
2549 phase: public
2550 parent: 2:97054abb4ab824450e9164180baf491ae0078465
2551 parent: -1:0000000000000000000000000000000000000000
2552 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2553 user: person
2554 date: Fri Jan 16 01:06:40 1970 +0000
2555 files: c
2556 extra: branch=default
2557 description:
2558 no user, no domain
2559
2560
2561 changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
2562 bisect: bad (implicit)
2563 branch: foo
2564 phase: draft
2565 parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47
2566 parent: -1:0000000000000000000000000000000000000000
2567 manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
2568 user: person
2569 date: Sat Jan 17 04:53:20 1970 +0000
2570 extra: branch=foo
2571 description:
2572 new branch
2573
2574
2575 $ hg log -v -T bisect -r 0:4
2576 changeset: 0:1e4e1b8f71e0
2577 bisect: good (implicit)
2578 user: User Name <user@hostname>
2579 date: Mon Jan 12 13:46:40 1970 +0000
2580 files: a
2581 description:
2582 line 1
2583 line 2
2584
2585
2586 changeset: 1:b608e9d1a3f0
2587 bisect: good
2588 user: A. N. Other <other@place>
2589 date: Tue Jan 13 17:33:20 1970 +0000
2590 files: b
2591 description:
2592 other 1
2593 other 2
2594
2595 other 3
2596
2597
2598 changeset: 2:97054abb4ab8
2599 bisect: untested
2600 user: other@place
2601 date: Wed Jan 14 21:20:00 1970 +0000
2602 files: c
2603 description:
2604 no person
2605
2606
2607 changeset: 3:10e46f2dcbf4
2608 bisect: bad
2609 user: person
2610 date: Fri Jan 16 01:06:40 1970 +0000
2611 files: c
2612 description:
2613 no user, no domain
2614
2615
2616 changeset: 4:bbe44766e73d
2617 bisect: bad (implicit)
2618 branch: foo
2619 user: person
2620 date: Sat Jan 17 04:53:20 1970 +0000
2621 description:
2622 new branch
2623
2624
2625 $ hg --color=debug log -T bisect -r 0:4
2626 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2627 [log.bisect bisect.good|bisect: good (implicit)]
2628 [log.user|user: User Name <user@hostname>]
2629 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2630 [log.summary|summary: line 1]
2631
2632 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2633 [log.bisect bisect.good|bisect: good]
2634 [log.user|user: A. N. Other <other@place>]
2635 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2636 [log.summary|summary: other 1]
2637
2638 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2639 [log.bisect bisect.untested|bisect: untested]
2640 [log.user|user: other@place]
2641 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2642 [log.summary|summary: no person]
2643
2644 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2645 [log.bisect bisect.bad|bisect: bad]
2646 [log.user|user: person]
2647 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2648 [log.summary|summary: no user, no domain]
2649
2650 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2651 [log.bisect bisect.bad|bisect: bad (implicit)]
2652 [log.branch|branch: foo]
2653 [log.user|user: person]
2654 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2655 [log.summary|summary: new branch]
2656
2657 $ hg --color=debug log --debug -T bisect -r 0:4
2658 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2659 [log.bisect bisect.good|bisect: good (implicit)]
2660 [log.phase|phase: public]
2661 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2662 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2663 [ui.debug log.manifest|manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0]
2664 [log.user|user: User Name <user@hostname>]
2665 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2666 [ui.debug log.files|files+: a]
2667 [ui.debug log.extra|extra: branch=default]
2668 [ui.note log.description|description:]
2669 [ui.note log.description|line 1
2670 line 2]
2671
2672
2673 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2674 [log.bisect bisect.good|bisect: good]
2675 [log.phase|phase: public]
2676 [log.parent changeset.public|parent: 0:1e4e1b8f71e05681d422154f5421e385fec3454f]
2677 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2678 [ui.debug log.manifest|manifest: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55]
2679 [log.user|user: A. N. Other <other@place>]
2680 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2681 [ui.debug log.files|files+: b]
2682 [ui.debug log.extra|extra: branch=default]
2683 [ui.note log.description|description:]
2684 [ui.note log.description|other 1
2685 other 2
2686
2687 other 3]
2688
2689
2690 [log.changeset changeset.public|changeset: 2:97054abb4ab824450e9164180baf491ae0078465]
2691 [log.bisect bisect.untested|bisect: untested]
2692 [log.phase|phase: public]
2693 [log.parent changeset.public|parent: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965]
2694 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2695 [ui.debug log.manifest|manifest: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1]
2696 [log.user|user: other@place]
2697 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2698 [ui.debug log.files|files+: c]
2699 [ui.debug log.extra|extra: branch=default]
2700 [ui.note log.description|description:]
2701 [ui.note log.description|no person]
2702
2703
2704 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2705 [log.bisect bisect.bad|bisect: bad]
2706 [log.phase|phase: public]
2707 [log.parent changeset.public|parent: 2:97054abb4ab824450e9164180baf491ae0078465]
2708 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2709 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2710 [log.user|user: person]
2711 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2712 [ui.debug log.files|files: c]
2713 [ui.debug log.extra|extra: branch=default]
2714 [ui.note log.description|description:]
2715 [ui.note log.description|no user, no domain]
2716
2717
2718 [log.changeset changeset.draft|changeset: 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74]
2719 [log.bisect bisect.bad|bisect: bad (implicit)]
2720 [log.branch|branch: foo]
2721 [log.phase|phase: draft]
2722 [log.parent changeset.public|parent: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47]
2723 [log.parent changeset.public|parent: -1:0000000000000000000000000000000000000000]
2724 [ui.debug log.manifest|manifest: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc]
2725 [log.user|user: person]
2726 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2727 [ui.debug log.extra|extra: branch=foo]
2728 [ui.note log.description|description:]
2729 [ui.note log.description|new branch]
2730
2731
2732 $ hg --color=debug log -v -T bisect -r 0:4
2733 [log.changeset changeset.public|changeset: 0:1e4e1b8f71e0]
2734 [log.bisect bisect.good|bisect: good (implicit)]
2735 [log.user|user: User Name <user@hostname>]
2736 [log.date|date: Mon Jan 12 13:46:40 1970 +0000]
2737 [ui.note log.files|files: a]
2738 [ui.note log.description|description:]
2739 [ui.note log.description|line 1
2740 line 2]
2741
2742
2743 [log.changeset changeset.public|changeset: 1:b608e9d1a3f0]
2744 [log.bisect bisect.good|bisect: good]
2745 [log.user|user: A. N. Other <other@place>]
2746 [log.date|date: Tue Jan 13 17:33:20 1970 +0000]
2747 [ui.note log.files|files: b]
2748 [ui.note log.description|description:]
2749 [ui.note log.description|other 1
2750 other 2
2751
2752 other 3]
2753
2754
2755 [log.changeset changeset.public|changeset: 2:97054abb4ab8]
2756 [log.bisect bisect.untested|bisect: untested]
2757 [log.user|user: other@place]
2758 [log.date|date: Wed Jan 14 21:20:00 1970 +0000]
2759 [ui.note log.files|files: c]
2760 [ui.note log.description|description:]
2761 [ui.note log.description|no person]
2762
2763
2764 [log.changeset changeset.public|changeset: 3:10e46f2dcbf4]
2765 [log.bisect bisect.bad|bisect: bad]
2766 [log.user|user: person]
2767 [log.date|date: Fri Jan 16 01:06:40 1970 +0000]
2768 [ui.note log.files|files: c]
2769 [ui.note log.description|description:]
2770 [ui.note log.description|no user, no domain]
2771
2772
2773 [log.changeset changeset.draft|changeset: 4:bbe44766e73d]
2774 [log.bisect bisect.bad|bisect: bad (implicit)]
2775 [log.branch|branch: foo]
2776 [log.user|user: person]
2777 [log.date|date: Sat Jan 17 04:53:20 1970 +0000]
2778 [ui.note log.description|description:]
2779 [ui.note log.description|new branch]
2780
2781
2782 $ hg bisect --reset
2783
2784 Error on syntax:
2785
2786 $ echo 'x = "f' >> t
1167 $ echo '[ui]' > .hg/hgrc
1168 $ echo 'style = t' >> .hg/hgrc
2787 1169 $ hg log
2788 1170 hg: parse error at t:3: unmatched quotes
2789 1171 [255]
@@ -3191,40 +1573,6 b' Merged tag overrides:'
3191 1573
3192 1574 $ cd ..
3193 1575
3194
3195 Style path expansion: issue1948 - ui.style option doesn't work on OSX
3196 if it is a relative path
3197
3198 $ mkdir -p home/styles
3199
3200 $ cat > home/styles/teststyle <<EOF
3201 > changeset = 'test {rev}:{node|short}\n'
3202 > EOF
3203
3204 $ HOME=`pwd`/home; export HOME
3205
3206 $ cat > latesttag/.hg/hgrc <<EOF
3207 > [ui]
3208 > style = ~/styles/teststyle
3209 > EOF
3210
3211 $ hg -R latesttag tip
3212 test 11:97e5943b523a
3213
3214 Test recursive showlist template (issue1989):
3215
3216 $ cat > style1989 <<EOF
3217 > changeset = '{file_mods}{manifest}{extras}'
3218 > file_mod = 'M|{author|person}\n'
3219 > manifest = '{rev},{author}\n'
3220 > extra = '{key}: {author}\n'
3221 > EOF
3222
3223 $ hg -R latesttag log -r tip --style=style1989
3224 M|test
3225 11,test
3226 branch: test
3227
3228 1576 Test new-style inline templating:
3229 1577
3230 1578 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
This diff has been collapsed as it changes many lines, (3289 lines changed) Show them Hide them
@@ -1,3 +1,6 b''
1 Test template map files and styles
2 ==================================
3
1 4 $ hg init a
2 5 $ cd a
3 6 $ echo a > a
@@ -29,165 +32,6 b''
29 32 $ hg merge -q foo
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,49 +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 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 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 49 Make sure user/global hgrc does not affect tests
249 50
250 51 $ echo '[ui]' > .hg/hgrc
@@ -1292,72 +1093,8 b' Include works:'
1292 1093 1
1293 1094 0
1294 1095
1295 Check that recursive reference does not fall into RuntimeError (issue4758):
1296
1297 common mistake:
1298
1299 $ cat << EOF > issue4758
1300 > changeset = '{changeset}\n'
1301 > EOF
1302 $ hg log --style ./issue4758
1303 abort: recursive reference 'changeset' in template
1304 [255]
1305
1306 circular reference:
1307
1308 $ cat << EOF > issue4758
1309 > changeset = '{foo}'
1310 > foo = '{changeset}'
1311 > EOF
1312 $ hg log --style ./issue4758
1313 abort: recursive reference 'foo' in template
1314 [255]
1315
1316 buildmap() -> gettemplate(), where no thunk was made:
1317
1318 $ cat << EOF > issue4758
1319 > changeset = '{files % changeset}\n'
1320 > EOF
1321 $ hg log --style ./issue4758
1322 abort: recursive reference 'changeset' in template
1323 [255]
1324
1325 not a recursion if a keyword of the same name exists:
1326
1327 $ cat << EOF > issue4758
1328 > changeset = '{tags % rev}'
1329 > rev = '{rev} {tag}\n'
1330 > EOF
1331 $ hg log --style ./issue4758 -r tip
1332 8 tip
1333
1334 Check that {phase} works correctly on parents:
1335
1336 $ cat << EOF > parentphase
1337 > changeset_debug = '{rev} ({phase}):{parents}\n'
1338 > parent = ' {rev} ({phase})'
1339 > EOF
1340 1096 $ hg phase -r 5 --public
1341 1097 $ hg phase -r 7 --secret --force
1342 $ hg log --debug -G --style ./parentphase
1343 @ 8 (secret): 7 (secret) -1 (public)
1344 |
1345 o 7 (secret): -1 (public) -1 (public)
1346
1347 o 6 (draft): 5 (public) 4 (draft)
1348 |\
1349 | o 5 (public): 3 (public) -1 (public)
1350 | |
1351 o | 4 (draft): 3 (public) -1 (public)
1352 |/
1353 o 3 (public): 2 (public) -1 (public)
1354 |
1355 o 2 (public): 1 (public) -1 (public)
1356 |
1357 o 1 (public): 0 (public) -1 (public)
1358 |
1359 o 0 (public): -1 (public) -1 (public)
1360
1361 1098
1362 1099 Missing non-standard names give no error (backward compatibility):
1363 1100
@@ -1396,7 +1133,6 b' ui.style works:'
1396 1133 1
1397 1134 0
1398 1135
1399
1400 1136 Issue338:
1401 1137
1402 1138 $ hg log --style=changelog > changelog
@@ -1475,842 +1211,12 b" Issue2130: xml output for 'hg heads' is "
1475 1211 [bbe44766e73d] <foo>
1476 1212
1477 1213
1478 Keys work:
1479
1480 $ for key in author branch branches date desc file_adds file_dels file_mods \
1481 > file_copies file_copies_switch files \
1482 > manifest node parents rev tags diffstat extras \
1483 > p1rev p2rev p1node p2node; do
1484 > for mode in '' --verbose --debug; do
1485 > hg log $mode --template "$key$mode: {$key}\n"
1486 > done
1487 > done
1488 author: test
1489 author: User Name <user@hostname>
1490 author: person
1491 author: person
1492 author: person
1493 author: person
1494 author: other@place
1495 author: A. N. Other <other@place>
1496 author: User Name <user@hostname>
1497 author--verbose: test
1498 author--verbose: User Name <user@hostname>
1499 author--verbose: person
1500 author--verbose: person
1501 author--verbose: person
1502 author--verbose: person
1503 author--verbose: other@place
1504 author--verbose: A. N. Other <other@place>
1505 author--verbose: User Name <user@hostname>
1506 author--debug: test
1507 author--debug: User Name <user@hostname>
1508 author--debug: person
1509 author--debug: person
1510 author--debug: person
1511 author--debug: person
1512 author--debug: other@place
1513 author--debug: A. N. Other <other@place>
1514 author--debug: User Name <user@hostname>
1515 branch: default
1516 branch: default
1517 branch: default
1518 branch: default
1519 branch: foo
1520 branch: default
1521 branch: default
1522 branch: default
1523 branch: default
1524 branch--verbose: default
1525 branch--verbose: default
1526 branch--verbose: default
1527 branch--verbose: default
1528 branch--verbose: foo
1529 branch--verbose: default
1530 branch--verbose: default
1531 branch--verbose: default
1532 branch--verbose: default
1533 branch--debug: default
1534 branch--debug: default
1535 branch--debug: default
1536 branch--debug: default
1537 branch--debug: foo
1538 branch--debug: default
1539 branch--debug: default
1540 branch--debug: default
1541 branch--debug: default
1542 branches:
1543 branches:
1544 branches:
1545 branches:
1546 branches: foo
1547 branches:
1548 branches:
1549 branches:
1550 branches:
1551 branches--verbose:
1552 branches--verbose:
1553 branches--verbose:
1554 branches--verbose:
1555 branches--verbose: foo
1556 branches--verbose:
1557 branches--verbose:
1558 branches--verbose:
1559 branches--verbose:
1560 branches--debug:
1561 branches--debug:
1562 branches--debug:
1563 branches--debug:
1564 branches--debug: foo
1565 branches--debug:
1566 branches--debug:
1567 branches--debug:
1568 branches--debug:
1569 date: 1577872860.00
1570 date: 1000000.00
1571 date: 1500001.00
1572 date: 1500000.00
1573 date: 1400000.00
1574 date: 1300000.00
1575 date: 1200000.00
1576 date: 1100000.00
1577 date: 1000000.00
1578 date--verbose: 1577872860.00
1579 date--verbose: 1000000.00
1580 date--verbose: 1500001.00
1581 date--verbose: 1500000.00
1582 date--verbose: 1400000.00
1583 date--verbose: 1300000.00
1584 date--verbose: 1200000.00
1585 date--verbose: 1100000.00
1586 date--verbose: 1000000.00
1587 date--debug: 1577872860.00
1588 date--debug: 1000000.00
1589 date--debug: 1500001.00
1590 date--debug: 1500000.00
1591 date--debug: 1400000.00
1592 date--debug: 1300000.00
1593 date--debug: 1200000.00
1594 date--debug: 1100000.00
1595 date--debug: 1000000.00
1596 desc: third
1597 desc: second
1598 desc: merge
1599 desc: new head
1600 desc: new branch
1601 desc: no user, no domain
1602 desc: no person
1603 desc: other 1
1604 other 2
1605
1606 other 3
1607 desc: line 1
1608 line 2
1609 desc--verbose: third
1610 desc--verbose: second
1611 desc--verbose: merge
1612 desc--verbose: new head
1613 desc--verbose: new branch
1614 desc--verbose: no user, no domain
1615 desc--verbose: no person
1616 desc--verbose: other 1
1617 other 2
1618
1619 other 3
1620 desc--verbose: line 1
1621 line 2
1622 desc--debug: third
1623 desc--debug: second
1624 desc--debug: merge
1625 desc--debug: new head
1626 desc--debug: new branch
1627 desc--debug: no user, no domain
1628 desc--debug: no person
1629 desc--debug: other 1
1630 other 2
1631
1632 other 3
1633 desc--debug: line 1
1634 line 2
1635 file_adds: fourth third
1636 file_adds: second
1637 file_adds:
1638 file_adds: d
1639 file_adds:
1640 file_adds:
1641 file_adds: c
1642 file_adds: b
1643 file_adds: a
1644 file_adds--verbose: fourth third
1645 file_adds--verbose: second
1646 file_adds--verbose:
1647 file_adds--verbose: d
1648 file_adds--verbose:
1649 file_adds--verbose:
1650 file_adds--verbose: c
1651 file_adds--verbose: b
1652 file_adds--verbose: a
1653 file_adds--debug: fourth third
1654 file_adds--debug: second
1655 file_adds--debug:
1656 file_adds--debug: d
1657 file_adds--debug:
1658 file_adds--debug:
1659 file_adds--debug: c
1660 file_adds--debug: b
1661 file_adds--debug: a
1662 file_dels: second
1663 file_dels:
1664 file_dels:
1665 file_dels:
1666 file_dels:
1667 file_dels:
1668 file_dels:
1669 file_dels:
1670 file_dels:
1671 file_dels--verbose: second
1672 file_dels--verbose:
1673 file_dels--verbose:
1674 file_dels--verbose:
1675 file_dels--verbose:
1676 file_dels--verbose:
1677 file_dels--verbose:
1678 file_dels--verbose:
1679 file_dels--verbose:
1680 file_dels--debug: second
1681 file_dels--debug:
1682 file_dels--debug:
1683 file_dels--debug:
1684 file_dels--debug:
1685 file_dels--debug:
1686 file_dels--debug:
1687 file_dels--debug:
1688 file_dels--debug:
1689 file_mods:
1690 file_mods:
1691 file_mods:
1692 file_mods:
1693 file_mods:
1694 file_mods: c
1695 file_mods:
1696 file_mods:
1697 file_mods:
1698 file_mods--verbose:
1699 file_mods--verbose:
1700 file_mods--verbose:
1701 file_mods--verbose:
1702 file_mods--verbose:
1703 file_mods--verbose: c
1704 file_mods--verbose:
1705 file_mods--verbose:
1706 file_mods--verbose:
1707 file_mods--debug:
1708 file_mods--debug:
1709 file_mods--debug:
1710 file_mods--debug:
1711 file_mods--debug:
1712 file_mods--debug: c
1713 file_mods--debug:
1714 file_mods--debug:
1715 file_mods--debug:
1716 file_copies: fourth (second)
1717 file_copies:
1718 file_copies:
1719 file_copies:
1720 file_copies:
1721 file_copies:
1722 file_copies:
1723 file_copies:
1724 file_copies:
1725 file_copies--verbose: fourth (second)
1726 file_copies--verbose:
1727 file_copies--verbose:
1728 file_copies--verbose:
1729 file_copies--verbose:
1730 file_copies--verbose:
1731 file_copies--verbose:
1732 file_copies--verbose:
1733 file_copies--verbose:
1734 file_copies--debug: fourth (second)
1735 file_copies--debug:
1736 file_copies--debug:
1737 file_copies--debug:
1738 file_copies--debug:
1739 file_copies--debug:
1740 file_copies--debug:
1741 file_copies--debug:
1742 file_copies--debug:
1743 file_copies_switch:
1744 file_copies_switch:
1745 file_copies_switch:
1746 file_copies_switch:
1747 file_copies_switch:
1748 file_copies_switch:
1749 file_copies_switch:
1750 file_copies_switch:
1751 file_copies_switch:
1752 file_copies_switch--verbose:
1753 file_copies_switch--verbose:
1754 file_copies_switch--verbose:
1755 file_copies_switch--verbose:
1756 file_copies_switch--verbose:
1757 file_copies_switch--verbose:
1758 file_copies_switch--verbose:
1759 file_copies_switch--verbose:
1760 file_copies_switch--verbose:
1761 file_copies_switch--debug:
1762 file_copies_switch--debug:
1763 file_copies_switch--debug:
1764 file_copies_switch--debug:
1765 file_copies_switch--debug:
1766 file_copies_switch--debug:
1767 file_copies_switch--debug:
1768 file_copies_switch--debug:
1769 file_copies_switch--debug:
1770 files: fourth second third
1771 files: second
1772 files:
1773 files: d
1774 files:
1775 files: c
1776 files: c
1777 files: b
1778 files: a
1779 files--verbose: fourth second third
1780 files--verbose: second
1781 files--verbose:
1782 files--verbose: d
1783 files--verbose:
1784 files--verbose: c
1785 files--verbose: c
1786 files--verbose: b
1787 files--verbose: a
1788 files--debug: fourth second third
1789 files--debug: second
1790 files--debug:
1791 files--debug: d
1792 files--debug:
1793 files--debug: c
1794 files--debug: c
1795 files--debug: b
1796 files--debug: a
1797 manifest: 6:94961b75a2da
1798 manifest: 5:f2dbc354b94e
1799 manifest: 4:4dc3def4f9b4
1800 manifest: 4:4dc3def4f9b4
1801 manifest: 3:cb5a1327723b
1802 manifest: 3:cb5a1327723b
1803 manifest: 2:6e0e82995c35
1804 manifest: 1:4e8d705b1e53
1805 manifest: 0:a0c8bcbbb45c
1806 manifest--verbose: 6:94961b75a2da
1807 manifest--verbose: 5:f2dbc354b94e
1808 manifest--verbose: 4:4dc3def4f9b4
1809 manifest--verbose: 4:4dc3def4f9b4
1810 manifest--verbose: 3:cb5a1327723b
1811 manifest--verbose: 3:cb5a1327723b
1812 manifest--verbose: 2:6e0e82995c35
1813 manifest--verbose: 1:4e8d705b1e53
1814 manifest--verbose: 0:a0c8bcbbb45c
1815 manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
1816 manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
1817 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1818 manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
1819 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1820 manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
1821 manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
1822 manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
1823 manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
1824 node: 95c24699272ef57d062b8bccc32c878bf841784a
1825 node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1826 node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1827 node: 13207e5a10d9fd28ec424934298e176197f2c67f
1828 node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1829 node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1830 node: 97054abb4ab824450e9164180baf491ae0078465
1831 node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1832 node: 1e4e1b8f71e05681d422154f5421e385fec3454f
1833 node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
1834 node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1835 node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1836 node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
1837 node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1838 node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1839 node--verbose: 97054abb4ab824450e9164180baf491ae0078465
1840 node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1841 node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
1842 node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
1843 node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
1844 node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
1845 node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
1846 node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
1847 node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
1848 node--debug: 97054abb4ab824450e9164180baf491ae0078465
1849 node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
1850 node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
1851 parents:
1852 parents: -1:000000000000
1853 parents: 5:13207e5a10d9 4:bbe44766e73d
1854 parents: 3:10e46f2dcbf4
1855 parents:
1856 parents:
1857 parents:
1858 parents:
1859 parents:
1860 parents--verbose:
1861 parents--verbose: -1:000000000000
1862 parents--verbose: 5:13207e5a10d9 4:bbe44766e73d
1863 parents--verbose: 3:10e46f2dcbf4
1864 parents--verbose:
1865 parents--verbose:
1866 parents--verbose:
1867 parents--verbose:
1868 parents--verbose:
1869 parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000
1870 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1871 parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
1872 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1873 parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000
1874 parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000
1875 parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000
1876 parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000
1877 parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000
1878 rev: 8
1879 rev: 7
1880 rev: 6
1881 rev: 5
1882 rev: 4
1883 rev: 3
1884 rev: 2
1885 rev: 1
1886 rev: 0
1887 rev--verbose: 8
1888 rev--verbose: 7
1889 rev--verbose: 6
1890 rev--verbose: 5
1891 rev--verbose: 4
1892 rev--verbose: 3
1893 rev--verbose: 2
1894 rev--verbose: 1
1895 rev--verbose: 0
1896 rev--debug: 8
1897 rev--debug: 7
1898 rev--debug: 6
1899 rev--debug: 5
1900 rev--debug: 4
1901 rev--debug: 3
1902 rev--debug: 2
1903 rev--debug: 1
1904 rev--debug: 0
1905 tags: tip
1906 tags:
1907 tags:
1908 tags:
1909 tags:
1910 tags:
1911 tags:
1912 tags:
1913 tags:
1914 tags--verbose: tip
1915 tags--verbose:
1916 tags--verbose:
1917 tags--verbose:
1918 tags--verbose:
1919 tags--verbose:
1920 tags--verbose:
1921 tags--verbose:
1922 tags--verbose:
1923 tags--debug: tip
1924 tags--debug:
1925 tags--debug:
1926 tags--debug:
1927 tags--debug:
1928 tags--debug:
1929 tags--debug:
1930 tags--debug:
1931 tags--debug:
1932 diffstat: 3: +2/-1
1933 diffstat: 1: +1/-0
1934 diffstat: 0: +0/-0
1935 diffstat: 1: +1/-0
1936 diffstat: 0: +0/-0
1937 diffstat: 1: +1/-0
1938 diffstat: 1: +4/-0
1939 diffstat: 1: +2/-0
1940 diffstat: 1: +1/-0
1941 diffstat--verbose: 3: +2/-1
1942 diffstat--verbose: 1: +1/-0
1943 diffstat--verbose: 0: +0/-0
1944 diffstat--verbose: 1: +1/-0
1945 diffstat--verbose: 0: +0/-0
1946 diffstat--verbose: 1: +1/-0
1947 diffstat--verbose: 1: +4/-0
1948 diffstat--verbose: 1: +2/-0
1949 diffstat--verbose: 1: +1/-0
1950 diffstat--debug: 3: +2/-1
1951 diffstat--debug: 1: +1/-0
1952 diffstat--debug: 0: +0/-0
1953 diffstat--debug: 1: +1/-0
1954 diffstat--debug: 0: +0/-0
1955 diffstat--debug: 1: +1/-0
1956 diffstat--debug: 1: +4/-0
1957 diffstat--debug: 1: +2/-0
1958 diffstat--debug: 1: +1/-0
1959 extras: branch=default
1960 extras: branch=default
1961 extras: branch=default
1962 extras: branch=default
1963 extras: branch=foo
1964 extras: branch=default
1965 extras: branch=default
1966 extras: branch=default
1967 extras: branch=default
1968 extras--verbose: branch=default
1969 extras--verbose: branch=default
1970 extras--verbose: branch=default
1971 extras--verbose: branch=default
1972 extras--verbose: branch=foo
1973 extras--verbose: branch=default
1974 extras--verbose: branch=default
1975 extras--verbose: branch=default
1976 extras--verbose: branch=default
1977 extras--debug: branch=default
1978 extras--debug: branch=default
1979 extras--debug: branch=default
1980 extras--debug: branch=default
1981 extras--debug: branch=foo
1982 extras--debug: branch=default
1983 extras--debug: branch=default
1984 extras--debug: branch=default
1985 extras--debug: branch=default
1986 p1rev: 7
1987 p1rev: -1
1988 p1rev: 5
1989 p1rev: 3
1990 p1rev: 3
1991 p1rev: 2
1992 p1rev: 1
1993 p1rev: 0
1994 p1rev: -1
1995 p1rev--verbose: 7
1996 p1rev--verbose: -1
1997 p1rev--verbose: 5
1998 p1rev--verbose: 3
1999 p1rev--verbose: 3
2000 p1rev--verbose: 2
2001 p1rev--verbose: 1
2002 p1rev--verbose: 0
2003 p1rev--verbose: -1
2004 p1rev--debug: 7
2005 p1rev--debug: -1
2006 p1rev--debug: 5
2007 p1rev--debug: 3
2008 p1rev--debug: 3
2009 p1rev--debug: 2
2010 p1rev--debug: 1
2011 p1rev--debug: 0
2012 p1rev--debug: -1
2013 p2rev: -1
2014 p2rev: -1
2015 p2rev: 4
2016 p2rev: -1
2017 p2rev: -1
2018 p2rev: -1
2019 p2rev: -1
2020 p2rev: -1
2021 p2rev: -1
2022 p2rev--verbose: -1
2023 p2rev--verbose: -1
2024 p2rev--verbose: 4
2025 p2rev--verbose: -1
2026 p2rev--verbose: -1
2027 p2rev--verbose: -1
2028 p2rev--verbose: -1
2029 p2rev--verbose: -1
2030 p2rev--verbose: -1
2031 p2rev--debug: -1
2032 p2rev--debug: -1
2033 p2rev--debug: 4
2034 p2rev--debug: -1
2035 p2rev--debug: -1
2036 p2rev--debug: -1
2037 p2rev--debug: -1
2038 p2rev--debug: -1
2039 p2rev--debug: -1
2040 p1node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2041 p1node: 0000000000000000000000000000000000000000
2042 p1node: 13207e5a10d9fd28ec424934298e176197f2c67f
2043 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2044 p1node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2045 p1node: 97054abb4ab824450e9164180baf491ae0078465
2046 p1node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2047 p1node: 1e4e1b8f71e05681d422154f5421e385fec3454f
2048 p1node: 0000000000000000000000000000000000000000
2049 p1node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2050 p1node--verbose: 0000000000000000000000000000000000000000
2051 p1node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
2052 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2053 p1node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2054 p1node--verbose: 97054abb4ab824450e9164180baf491ae0078465
2055 p1node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2056 p1node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
2057 p1node--verbose: 0000000000000000000000000000000000000000
2058 p1node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
2059 p1node--debug: 0000000000000000000000000000000000000000
2060 p1node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
2061 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2062 p1node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
2063 p1node--debug: 97054abb4ab824450e9164180baf491ae0078465
2064 p1node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
2065 p1node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
2066 p1node--debug: 0000000000000000000000000000000000000000
2067 p2node: 0000000000000000000000000000000000000000
2068 p2node: 0000000000000000000000000000000000000000
2069 p2node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2070 p2node: 0000000000000000000000000000000000000000
2071 p2node: 0000000000000000000000000000000000000000
2072 p2node: 0000000000000000000000000000000000000000
2073 p2node: 0000000000000000000000000000000000000000
2074 p2node: 0000000000000000000000000000000000000000
2075 p2node: 0000000000000000000000000000000000000000
2076 p2node--verbose: 0000000000000000000000000000000000000000
2077 p2node--verbose: 0000000000000000000000000000000000000000
2078 p2node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2079 p2node--verbose: 0000000000000000000000000000000000000000
2080 p2node--verbose: 0000000000000000000000000000000000000000
2081 p2node--verbose: 0000000000000000000000000000000000000000
2082 p2node--verbose: 0000000000000000000000000000000000000000
2083 p2node--verbose: 0000000000000000000000000000000000000000
2084 p2node--verbose: 0000000000000000000000000000000000000000
2085 p2node--debug: 0000000000000000000000000000000000000000
2086 p2node--debug: 0000000000000000000000000000000000000000
2087 p2node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
2088 p2node--debug: 0000000000000000000000000000000000000000
2089 p2node--debug: 0000000000000000000000000000000000000000
2090 p2node--debug: 0000000000000000000000000000000000000000
2091 p2node--debug: 0000000000000000000000000000000000000000
2092 p2node--debug: 0000000000000000000000000000000000000000
2093 p2node--debug: 0000000000000000000000000000000000000000
2094
2095 Filters work:
2096
2097 $ hg log --template '{author|domain}\n'
2098
2099 hostname
2100
2101
2102
2103
2104 place
2105 place
2106 hostname
2107
2108 $ hg log --template '{author|person}\n'
2109 test
2110 User Name
2111 person
2112 person
2113 person
2114 person
2115 other
2116 A. N. Other
2117 User Name
2118
2119 $ hg log --template '{author|user}\n'
2120 test
2121 user
2122 person
2123 person
2124 person
2125 person
2126 other
2127 other
2128 user
2129
2130 $ hg log --template '{date|date}\n'
2131 Wed Jan 01 10:01:00 2020 +0000
2132 Mon Jan 12 13:46:40 1970 +0000
2133 Sun Jan 18 08:40:01 1970 +0000
2134 Sun Jan 18 08:40:00 1970 +0000
2135 Sat Jan 17 04:53:20 1970 +0000
2136 Fri Jan 16 01:06:40 1970 +0000
2137 Wed Jan 14 21:20:00 1970 +0000
2138 Tue Jan 13 17:33:20 1970 +0000
2139 Mon Jan 12 13:46:40 1970 +0000
2140
2141 $ hg log --template '{date|isodate}\n'
2142 2020-01-01 10:01 +0000
2143 1970-01-12 13:46 +0000
2144 1970-01-18 08:40 +0000
2145 1970-01-18 08:40 +0000
2146 1970-01-17 04:53 +0000
2147 1970-01-16 01:06 +0000
2148 1970-01-14 21:20 +0000
2149 1970-01-13 17:33 +0000
2150 1970-01-12 13:46 +0000
2151
2152 $ hg log --template '{date|isodatesec}\n'
2153 2020-01-01 10:01:00 +0000
2154 1970-01-12 13:46:40 +0000
2155 1970-01-18 08:40:01 +0000
2156 1970-01-18 08:40:00 +0000
2157 1970-01-17 04:53:20 +0000
2158 1970-01-16 01:06:40 +0000
2159 1970-01-14 21:20:00 +0000
2160 1970-01-13 17:33:20 +0000
2161 1970-01-12 13:46:40 +0000
2162
2163 $ hg log --template '{date|rfc822date}\n'
2164 Wed, 01 Jan 2020 10:01:00 +0000
2165 Mon, 12 Jan 1970 13:46:40 +0000
2166 Sun, 18 Jan 1970 08:40:01 +0000
2167 Sun, 18 Jan 1970 08:40:00 +0000
2168 Sat, 17 Jan 1970 04:53:20 +0000
2169 Fri, 16 Jan 1970 01:06:40 +0000
2170 Wed, 14 Jan 1970 21:20:00 +0000
2171 Tue, 13 Jan 1970 17:33:20 +0000
2172 Mon, 12 Jan 1970 13:46:40 +0000
2173
2174 $ hg log --template '{desc|firstline}\n'
2175 third
2176 second
2177 merge
2178 new head
2179 new branch
2180 no user, no domain
2181 no person
2182 other 1
2183 line 1
2184
2185 $ hg log --template '{node|short}\n'
2186 95c24699272e
2187 29114dbae42b
2188 d41e714fe50d
2189 13207e5a10d9
2190 bbe44766e73d
2191 10e46f2dcbf4
2192 97054abb4ab8
2193 b608e9d1a3f0
2194 1e4e1b8f71e0
2195
2196 $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
2197 <changeset author="test"/>
2198 <changeset author="User Name &lt;user@hostname&gt;"/>
2199 <changeset author="person"/>
2200 <changeset author="person"/>
2201 <changeset author="person"/>
2202 <changeset author="person"/>
2203 <changeset author="other@place"/>
2204 <changeset author="A. N. Other &lt;other@place&gt;"/>
2205 <changeset author="User Name &lt;user@hostname&gt;"/>
2206
2207 $ hg log --template '{rev}: {children}\n'
2208 8:
2209 7: 8:95c24699272e
2210 6:
2211 5: 6:d41e714fe50d
2212 4: 6:d41e714fe50d
2213 3: 4:bbe44766e73d 5:13207e5a10d9
2214 2: 3:10e46f2dcbf4
2215 1: 2:97054abb4ab8
2216 0: 1:b608e9d1a3f0
2217
2218 Formatnode filter works:
2219
2220 $ hg -q log -r 0 --template '{node|formatnode}\n'
2221 1e4e1b8f71e0
2222
2223 $ hg log -r 0 --template '{node|formatnode}\n'
2224 1e4e1b8f71e0
2225
2226 $ hg -v log -r 0 --template '{node|formatnode}\n'
2227 1e4e1b8f71e0
2228
2229 $ hg --debug log -r 0 --template '{node|formatnode}\n'
2230 1e4e1b8f71e05681d422154f5421e385fec3454f
2231
2232 Age filter:
2233
2234 $ hg init unstable-hash
2235 $ cd unstable-hash
2236 $ hg log --template '{date|age}\n' > /dev/null || exit 1
2237
2238 >>> from __future__ import absolute_import
2239 >>> import datetime
2240 >>> fp = open('a', 'wb')
2241 >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7)
2242 >>> fp.write(b'%d-%d-%d 00:00' % (n.year, n.month, n.day)) and None
2243 >>> fp.close()
2244 $ hg add a
2245 $ hg commit -m future -d "`cat a`"
2246
2247 $ hg log -l1 --template '{date|age}\n'
2248 7 years from now
2249
2250 $ cd ..
2251 $ rm -rf unstable-hash
2252
2253 Filename filters:
2254
2255 $ hg debugtemplate '{"foo/bar"|basename}|{"foo/"|basename}|{"foo"|basename}|\n'
2256 bar||foo|
2257 $ hg debugtemplate '{"foo/bar"|dirname}|{"foo/"|dirname}|{"foo"|dirname}|\n'
2258 foo|foo||
2259 $ hg debugtemplate '{"foo/bar"|stripdir}|{"foo/"|stripdir}|{"foo"|stripdir}|\n'
2260 foo|foo|foo|
2261
2262 1214 Add a dummy commit to make up for the instability of the above:
2263 1215
2264 1216 $ echo a > a
2265 1217 $ hg add a
2266 1218 $ hg ci -m future
2267 1219
2268 Count filter:
2269
2270 $ hg log -l1 --template '{node|count} {node|short|count}\n'
2271 40 12
2272
2273 $ hg log -l1 --template '{revset("null^")|count} {revset(".")|count} {revset("0::3")|count}\n'
2274 0 1 4
2275
2276 $ hg log -G --template '{rev}: children: {children|count}, \
2277 > tags: {tags|count}, file_adds: {file_adds|count}, \
2278 > ancestors: {revset("ancestors(%s)", rev)|count}'
2279 @ 9: children: 0, tags: 1, file_adds: 1, ancestors: 3
2280 |
2281 o 8: children: 1, tags: 0, file_adds: 2, ancestors: 2
2282 |
2283 o 7: children: 1, tags: 0, file_adds: 1, ancestors: 1
2284
2285 o 6: children: 0, tags: 0, file_adds: 0, ancestors: 7
2286 |\
2287 | o 5: children: 1, tags: 0, file_adds: 1, ancestors: 5
2288 | |
2289 o | 4: children: 1, tags: 0, file_adds: 0, ancestors: 5
2290 |/
2291 o 3: children: 2, tags: 0, file_adds: 0, ancestors: 4
2292 |
2293 o 2: children: 1, tags: 0, file_adds: 1, ancestors: 3
2294 |
2295 o 1: children: 1, tags: 0, file_adds: 1, ancestors: 2
2296 |
2297 o 0: children: 1, tags: 0, file_adds: 1, ancestors: 1
2298
2299
2300 $ hg log -l1 -T '{termwidth|count}\n'
2301 hg: parse error: not countable
2302 (template filter 'count' is not compatible with keyword 'termwidth')
2303 [255]
2304
2305 Upper/lower filters:
2306
2307 $ hg log -r0 --template '{branch|upper}\n'
2308 DEFAULT
2309 $ hg log -r0 --template '{author|lower}\n'
2310 user name <user@hostname>
2311 $ hg log -r0 --template '{date|upper}\n'
2312 1000000.00
2313
2314 1220 Add a commit that does all possible modifications at once
2315 1221
2316 1222 $ echo modify >> third
@@ -2781,201 +1687,9 b' Check the bisect template'
2781 1687
2782 1688 $ hg bisect --reset
2783 1689
2784 Error on syntax:
2785
2786 $ echo 'x = "f' >> t
2787 $ hg log
2788 hg: parse error at t:3: unmatched quotes
2789 [255]
2790
2791 $ hg log -T '{date'
2792 hg: parse error at 1: unterminated template expansion
2793 ({date
2794 ^ here)
2795 [255]
2796 $ hg log -T '{date(}'
2797 hg: parse error at 6: not a prefix: end
2798 ({date(}
2799 ^ here)
2800 [255]
2801 $ hg log -T '{date)}'
2802 hg: parse error at 5: invalid token
2803 ({date)}
2804 ^ here)
2805 [255]
2806 $ hg log -T '{date date}'
2807 hg: parse error at 6: invalid token
2808 ({date date}
2809 ^ here)
2810 [255]
2811
2812 $ hg log -T '{}'
2813 hg: parse error at 1: not a prefix: end
2814 ({}
2815 ^ here)
2816 [255]
2817 $ hg debugtemplate -v '{()}'
2818 (template
2819 (group
2820 None))
2821 * keywords:
2822 * functions:
2823 hg: parse error: missing argument
2824 [255]
2825
2826 Behind the scenes, this would throw TypeError without intype=bytes
2827
2828 $ hg log -l 3 --template '{date|obfuscate}\n'
2829 &#48;&#46;&#48;&#48;
2830 &#48;&#46;&#48;&#48;
2831 &#49;&#53;&#55;&#55;&#56;&#55;&#50;&#56;&#54;&#48;&#46;&#48;&#48;
2832
2833 Behind the scenes, this will throw a ValueError
2834
2835 $ hg log -l 3 --template 'line: {desc|shortdate}\n'
2836 hg: parse error: invalid date: 'Modify, add, remove, rename'
2837 (template filter 'shortdate' is not compatible with keyword 'desc')
2838 [255]
2839
2840 Behind the scenes, this would throw AttributeError without intype=bytes
2841
2842 $ hg log -l 3 --template 'line: {date|escape}\n'
2843 line: 0.00
2844 line: 0.00
2845 line: 1577872860.00
2846
2847 $ hg log -l 3 --template 'line: {extras|localdate}\n'
2848 hg: parse error: localdate expects a date information
2849 [255]
2850
2851 Behind the scenes, this will throw ValueError
2852
2853 $ hg tip --template '{author|email|date}\n'
2854 hg: parse error: date expects a date information
2855 [255]
2856
2857 $ hg tip -T '{author|email|shortdate}\n'
2858 hg: parse error: invalid date: 'test'
2859 (template filter 'shortdate' is not compatible with keyword 'author')
2860 [255]
2861
2862 $ hg tip -T '{get(extras, "branch")|shortdate}\n'
2863 hg: parse error: invalid date: 'default'
2864 (incompatible use of template filter 'shortdate')
2865 [255]
2866
2867 Error in nested template:
2868
2869 $ hg log -T '{"date'
2870 hg: parse error at 2: unterminated string
2871 ({"date
2872 ^ here)
2873 [255]
2874
2875 $ hg log -T '{"foo{date|?}"}'
2876 hg: parse error at 11: syntax error
2877 ({"foo{date|?}"}
2878 ^ here)
2879 [255]
2880
2881 Thrown an error if a template function doesn't exist
2882
2883 $ hg tip --template '{foo()}\n'
2884 hg: parse error: unknown function 'foo'
2885 [255]
2886
2887 Pass generator object created by template function to filter
2888
2889 $ hg log -l 1 --template '{if(author, author)|user}\n'
2890 test
2891
2892 Test index keyword:
2893
2894 $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n'
2895 10 0:a 1:b 2:fifth 3:fourth 4:third
2896 11 0:a
2897
2898 $ hg branches -T '{index} {branch}\n'
2899 0 default
2900 1 foo
2901
2902 Test diff function:
2903
2904 $ hg diff -c 8
2905 diff -r 29114dbae42b -r 95c24699272e fourth
2906 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2907 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2908 @@ -0,0 +1,1 @@
2909 +second
2910 diff -r 29114dbae42b -r 95c24699272e second
2911 --- a/second Mon Jan 12 13:46:40 1970 +0000
2912 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2913 @@ -1,1 +0,0 @@
2914 -second
2915 diff -r 29114dbae42b -r 95c24699272e third
2916 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2917 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2918 @@ -0,0 +1,1 @@
2919 +third
2920
2921 $ hg log -r 8 -T "{diff()}"
2922 diff -r 29114dbae42b -r 95c24699272e fourth
2923 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2924 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2925 @@ -0,0 +1,1 @@
2926 +second
2927 diff -r 29114dbae42b -r 95c24699272e second
2928 --- a/second Mon Jan 12 13:46:40 1970 +0000
2929 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2930 @@ -1,1 +0,0 @@
2931 -second
2932 diff -r 29114dbae42b -r 95c24699272e third
2933 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2934 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2935 @@ -0,0 +1,1 @@
2936 +third
2937
2938 $ hg log -r 8 -T "{diff('glob:f*')}"
2939 diff -r 29114dbae42b -r 95c24699272e fourth
2940 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2941 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2942 @@ -0,0 +1,1 @@
2943 +second
2944
2945 $ hg log -r 8 -T "{diff('', 'glob:f*')}"
2946 diff -r 29114dbae42b -r 95c24699272e second
2947 --- a/second Mon Jan 12 13:46:40 1970 +0000
2948 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2949 @@ -1,1 +0,0 @@
2950 -second
2951 diff -r 29114dbae42b -r 95c24699272e third
2952 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2953 +++ b/third Wed Jan 01 10:01:00 2020 +0000
2954 @@ -0,0 +1,1 @@
2955 +third
2956
2957 $ hg log -r 8 -T "{diff('FOURTH'|lower)}"
2958 diff -r 29114dbae42b -r 95c24699272e fourth
2959 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2960 +++ b/fourth Wed Jan 01 10:01:00 2020 +0000
2961 @@ -0,0 +1,1 @@
2962 +second
2963
2964 ui verbosity:
2965
2966 $ hg log -l1 -T '{verbosity}\n'
2967
2968 $ hg log -l1 -T '{verbosity}\n' --debug
2969 debug
2970 $ hg log -l1 -T '{verbosity}\n' --quiet
2971 quiet
2972 $ hg log -l1 -T '{verbosity}\n' --verbose
2973 verbose
2974
2975 1690 $ cd ..
2976 1691
2977
2978 latesttag:
1692 Set up latesttag repository:
2979 1693
2980 1694 $ hg init latesttag
2981 1695 $ cd latesttag
@@ -3003,195 +1717,15 b' latesttag:'
3003 1717 $ hg merge -q
3004 1718 $ hg ci -m merge -d '5 -3600'
3005 1719
3006 No tag set:
3007
3008 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3009 @ 5: null+5
3010 |\
3011 | o 4: null+4
3012 | |
3013 | o 3: null+3
3014 | |
3015 o | 2: null+3
3016 |/
3017 o 1: null+2
3018 |
3019 o 0: null+1
3020
3021
3022 One common tag: longest path wins for {latesttagdistance}:
3023
3024 1720 $ hg tag -r 1 -m t1 -d '6 0' t1
3025 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3026 @ 6: t1+4
3027 |
3028 o 5: t1+3
3029 |\
3030 | o 4: t1+2
3031 | |
3032 | o 3: t1+1
3033 | |
3034 o | 2: t1+1
3035 |/
3036 o 1: t1+0
3037 |
3038 o 0: null+1
3039
3040
3041 One ancestor tag: closest wins:
3042
3043 1721 $ hg tag -r 2 -m t2 -d '7 0' t2
3044 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3045 @ 7: t2+3
3046 |
3047 o 6: t2+2
3048 |
3049 o 5: t2+1
3050 |\
3051 | o 4: t1+2
3052 | |
3053 | o 3: t1+1
3054 | |
3055 o | 2: t2+0
3056 |/
3057 o 1: t1+0
3058 |
3059 o 0: null+1
3060
3061
3062 Two branch tags: more recent wins if same number of changes:
3063
3064 1722 $ hg tag -r 3 -m t3 -d '8 0' t3
3065 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3066 @ 8: t3+5
3067 |
3068 o 7: t3+4
3069 |
3070 o 6: t3+3
3071 |
3072 o 5: t3+2
3073 |\
3074 | o 4: t3+1
3075 | |
3076 | o 3: t3+0
3077 | |
3078 o | 2: t2+0
3079 |/
3080 o 1: t1+0
3081 |
3082 o 0: null+1
3083
3084
3085 Two branch tags: fewest changes wins:
3086
3087 1723 $ hg tag -r 4 -m t4 -d '4 0' t4 # older than t2, but should not matter
3088 $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
3089 @ 9: t4+5,6
3090 |
3091 o 8: t4+4,5
3092 |
3093 o 7: t4+3,4
3094 |
3095 o 6: t4+2,3
3096 |
3097 o 5: t4+1,2
3098 |\
3099 | o 4: t4+0,0
3100 | |
3101 | o 3: t3+0,0
3102 | |
3103 o | 2: t2+0,0
3104 |/
3105 o 1: t1+0,0
3106 |
3107 o 0: null+1,1
3108
3109
3110 Merged tag overrides:
3111
3112 1724 $ hg tag -r 5 -m t5 -d '9 0' t5
3113 1725 $ hg tag -r 3 -m at3 -d '10 0' at3
3114 $ hg log -G --template '{rev}: {latesttag}+{latesttagdistance}\n'
3115 @ 11: t5+6
3116 |
3117 o 10: t5+5
3118 |
3119 o 9: t5+4
3120 |
3121 o 8: t5+3
3122 |
3123 o 7: t5+2
3124 |
3125 o 6: t5+1
3126 |
3127 o 5: t5+0
3128 |\
3129 | o 4: t4+0
3130 | |
3131 | o 3: at3:t3+0
3132 | |
3133 o | 2: t2+0
3134 |/
3135 o 1: t1+0
3136 |
3137 o 0: null+1
3138
3139
3140 $ hg log -G --template "{rev}: {latesttag % '{tag}+{distance},{changes} '}\n"
3141 @ 11: t5+6,6
3142 |
3143 o 10: t5+5,5
3144 |
3145 o 9: t5+4,4
3146 |
3147 o 8: t5+3,3
3148 |
3149 o 7: t5+2,2
3150 |
3151 o 6: t5+1,1
3152 |
3153 o 5: t5+0,0
3154 |\
3155 | o 4: t4+0,0
3156 | |
3157 | o 3: at3+0,0 t3+0,0
3158 | |
3159 o | 2: t2+0,0
3160 |/
3161 o 1: t1+0,0
3162 |
3163 o 0: null+1,1
3164
3165
3166 $ hg log -G --template "{rev}: {latesttag('re:^t[13]$') % '{tag}, C: {changes}, D: {distance}'}\n"
3167 @ 11: t3, C: 9, D: 8
3168 |
3169 o 10: t3, C: 8, D: 7
3170 |
3171 o 9: t3, C: 7, D: 6
3172 |
3173 o 8: t3, C: 6, D: 5
3174 |
3175 o 7: t3, C: 5, D: 4
3176 |
3177 o 6: t3, C: 4, D: 3
3178 |
3179 o 5: t3, C: 3, D: 2
3180 |\
3181 | o 4: t3, C: 1, D: 1
3182 | |
3183 | o 3: t3, C: 0, D: 0
3184 | |
3185 o | 2: t1, C: 1, D: 1
3186 |/
3187 o 1: t1, C: 0, D: 0
3188 |
3189 o 0: null, C: 1, D: 1
3190
3191 1726
3192 1727 $ cd ..
3193 1728
3194
3195 1729 Style path expansion: issue1948 - ui.style option doesn't work on OSX
3196 1730 if it is a relative path
3197 1731
@@ -3224,1818 +1758,3 b' Test recursive showlist template (issue1'
3224 1758 M|test
3225 1759 11,test
3226 1760 branch: test
3227
3228 Test new-style inline templating:
3229
3230 $ hg log -R latesttag -r tip --template 'modified files: {file_mods % " {file}\n"}\n'
3231 modified files: .hgtags
3232
3233
3234 $ hg log -R latesttag -r tip -T '{rev % "a"}\n'
3235 hg: parse error: 11 is not iterable of mappings
3236 (keyword 'rev' does not support map operation)
3237 [255]
3238 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "a"}\n'
3239 hg: parse error: None is not iterable of mappings
3240 [255]
3241 $ hg log -R latesttag -r tip -T '{extras % "{key}\n" % "{key}\n"}'
3242 hg: parse error: list of strings is not mappable
3243 [255]
3244
3245 Test new-style inline templating of non-list/dict type:
3246
3247 $ hg log -R latesttag -r tip -T '{manifest}\n'
3248 11:2bc6e9006ce2
3249 $ hg log -R latesttag -r tip -T 'string length: {manifest|count}\n'
3250 string length: 15
3251 $ hg log -R latesttag -r tip -T '{manifest % "{rev}:{node}"}\n'
3252 11:2bc6e9006ce29882383a22d39fd1f4e66dd3e2fc
3253
3254 $ hg log -R latesttag -r tip -T '{get(extras, "branch") % "{key}: {value}\n"}'
3255 branch: default
3256 $ hg log -R latesttag -r tip -T '{get(extras, "unknown") % "{key}\n"}'
3257 hg: parse error: None is not iterable of mappings
3258 [255]
3259 $ hg log -R latesttag -r tip -T '{min(extras) % "{key}: {value}\n"}'
3260 branch: default
3261 $ hg log -R latesttag -l1 -T '{min(revset("0:9")) % "{rev}:{node|short}\n"}'
3262 0:ce3cec86e6c2
3263 $ hg log -R latesttag -l1 -T '{max(revset("0:9")) % "{rev}:{node|short}\n"}'
3264 9:fbc7cd862e9c
3265
3266 Test manifest/get() can be join()-ed as string, though it's silly:
3267
3268 $ hg log -R latesttag -r tip -T '{join(manifest, ".")}\n'
3269 1.1.:.2.b.c.6.e.9.0.0.6.c.e.2
3270 $ hg log -R latesttag -r tip -T '{join(get(extras, "branch"), ".")}\n'
3271 d.e.f.a.u.l.t
3272
3273 Test join() over string
3274
3275 $ hg log -R latesttag -r tip -T '{join(rev|stringify, ".")}\n'
3276 1.1
3277
3278 Test join() over uniterable
3279
3280 $ hg log -R latesttag -r tip -T '{join(rev, "")}\n'
3281 hg: parse error: 11 is not iterable
3282 [255]
3283
3284 Test min/max of integers
3285
3286 $ hg log -R latesttag -l1 -T '{min(revset("9:10"))}\n'
3287 9
3288 $ hg log -R latesttag -l1 -T '{max(revset("9:10"))}\n'
3289 10
3290
3291 Test min/max over map operation:
3292
3293 $ hg log -R latesttag -r3 -T '{min(tags % "{tag}")}\n'
3294 at3
3295 $ hg log -R latesttag -r3 -T '{max(tags % "{tag}")}\n'
3296 t3
3297
3298 Test min/max of strings:
3299
3300 $ hg log -R latesttag -l1 -T '{min(desc)}\n'
3301 3
3302 $ hg log -R latesttag -l1 -T '{max(desc)}\n'
3303 t
3304
3305 Test min/max of non-iterable:
3306
3307 $ hg debugtemplate '{min(1)}'
3308 hg: parse error: 1 is not iterable
3309 (min first argument should be an iterable)
3310 [255]
3311 $ hg debugtemplate '{max(2)}'
3312 hg: parse error: 2 is not iterable
3313 (max first argument should be an iterable)
3314 [255]
3315
3316 $ hg log -R latesttag -l1 -T '{min(date)}'
3317 hg: parse error: date is not iterable
3318 (min first argument should be an iterable)
3319 [255]
3320 $ hg log -R latesttag -l1 -T '{max(date)}'
3321 hg: parse error: date is not iterable
3322 (max first argument should be an iterable)
3323 [255]
3324
3325 Test min/max of empty sequence:
3326
3327 $ hg debugtemplate '{min("")}'
3328 hg: parse error: empty string
3329 (min first argument should be an iterable)
3330 [255]
3331 $ hg debugtemplate '{max("")}'
3332 hg: parse error: empty string
3333 (max first argument should be an iterable)
3334 [255]
3335 $ hg debugtemplate '{min(dict())}'
3336 hg: parse error: empty sequence
3337 (min first argument should be an iterable)
3338 [255]
3339 $ hg debugtemplate '{max(dict())}'
3340 hg: parse error: empty sequence
3341 (max first argument should be an iterable)
3342 [255]
3343 $ hg debugtemplate '{min(dict() % "")}'
3344 hg: parse error: empty sequence
3345 (min first argument should be an iterable)
3346 [255]
3347 $ hg debugtemplate '{max(dict() % "")}'
3348 hg: parse error: empty sequence
3349 (max first argument should be an iterable)
3350 [255]
3351
3352 Test min/max of if() result
3353
3354 $ cd latesttag
3355 $ hg log -l1 -T '{min(if(true, revset("9:10"), ""))}\n'
3356 9
3357 $ hg log -l1 -T '{max(if(false, "", revset("9:10")))}\n'
3358 10
3359 $ hg log -l1 -T '{min(ifcontains("a", "aa", revset("9:10"), ""))}\n'
3360 9
3361 $ hg log -l1 -T '{max(ifcontains("a", "bb", "", revset("9:10")))}\n'
3362 10
3363 $ hg log -l1 -T '{min(ifeq(0, 0, revset("9:10"), ""))}\n'
3364 9
3365 $ hg log -l1 -T '{max(ifeq(0, 1, "", revset("9:10")))}\n'
3366 10
3367 $ cd ..
3368
3369 Test laziness of if() then/else clause
3370
3371 $ hg debugtemplate '{count(0)}'
3372 hg: parse error: not countable
3373 (incompatible use of template filter 'count')
3374 [255]
3375 $ hg debugtemplate '{if(true, "", count(0))}'
3376 $ hg debugtemplate '{if(false, count(0), "")}'
3377 $ hg debugtemplate '{ifcontains("a", "aa", "", count(0))}'
3378 $ hg debugtemplate '{ifcontains("a", "bb", count(0), "")}'
3379 $ hg debugtemplate '{ifeq(0, 0, "", count(0))}'
3380 $ hg debugtemplate '{ifeq(0, 1, count(0), "")}'
3381
3382 Test dot operator precedence:
3383
3384 $ hg debugtemplate -R latesttag -r0 -v '{manifest.node|short}\n'
3385 (template
3386 (|
3387 (.
3388 (symbol 'manifest')
3389 (symbol 'node'))
3390 (symbol 'short'))
3391 (string '\n'))
3392 * keywords: manifest, node, rev
3393 * functions: formatnode, short
3394 89f4071fec70
3395
3396 (the following examples are invalid, but seem natural in parsing POV)
3397
3398 $ hg debugtemplate -R latesttag -r0 -v '{foo|bar.baz}\n' 2> /dev/null
3399 (template
3400 (|
3401 (symbol 'foo')
3402 (.
3403 (symbol 'bar')
3404 (symbol 'baz')))
3405 (string '\n'))
3406 [255]
3407 $ hg debugtemplate -R latesttag -r0 -v '{foo.bar()}\n' 2> /dev/null
3408 (template
3409 (.
3410 (symbol 'foo')
3411 (func
3412 (symbol 'bar')
3413 None))
3414 (string '\n'))
3415 * keywords: foo
3416 * functions: bar
3417 [255]
3418
3419 Test evaluation of dot operator:
3420
3421 $ hg log -R latesttag -l1 -T '{min(revset("0:9")).node}\n'
3422 ce3cec86e6c26bd9bdfc590a6b92abc9680f1796
3423 $ hg log -R latesttag -r0 -T '{extras.branch}\n'
3424 default
3425 $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n'
3426 0 -7200
3427
3428 $ hg log -R latesttag -l1 -T '{author.invalid}\n'
3429 hg: parse error: 'test' is not a dictionary
3430 (keyword 'author' does not support member operation)
3431 [255]
3432 $ hg log -R latesttag -l1 -T '{min("abc").invalid}\n'
3433 hg: parse error: 'a' is not a dictionary
3434 [255]
3435
3436 Test the sub function of templating for expansion:
3437
3438 $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n'
3439 xx
3440
3441 $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n'
3442 hg: parse error: sub got an invalid pattern: [
3443 [255]
3444 $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n'
3445 hg: parse error: sub got an invalid replacement: \1
3446 [255]
3447
3448 Test the strip function with chars specified:
3449
3450 $ hg log -R latesttag --template '{desc}\n'
3451 at3
3452 t5
3453 t4
3454 t3
3455 t2
3456 t1
3457 merge
3458 h2e
3459 h2d
3460 h1c
3461 b
3462 a
3463
3464 $ hg log -R latesttag --template '{strip(desc, "te")}\n'
3465 at3
3466 5
3467 4
3468 3
3469 2
3470 1
3471 merg
3472 h2
3473 h2d
3474 h1c
3475 b
3476 a
3477
3478 Test date format:
3479
3480 $ hg log -R latesttag --template 'date: {date(date, "%y %m %d %S %z")}\n'
3481 date: 70 01 01 10 +0000
3482 date: 70 01 01 09 +0000
3483 date: 70 01 01 04 +0000
3484 date: 70 01 01 08 +0000
3485 date: 70 01 01 07 +0000
3486 date: 70 01 01 06 +0000
3487 date: 70 01 01 05 +0100
3488 date: 70 01 01 04 +0000
3489 date: 70 01 01 03 +0000
3490 date: 70 01 01 02 +0000
3491 date: 70 01 01 01 +0000
3492 date: 70 01 01 00 +0000
3493
3494 Test invalid date:
3495
3496 $ hg log -R latesttag -T '{date(rev)}\n'
3497 hg: parse error: date expects a date information
3498 [255]
3499
3500 Test integer literal:
3501
3502 $ hg debugtemplate -v '{(0)}\n'
3503 (template
3504 (group
3505 (integer '0'))
3506 (string '\n'))
3507 * keywords:
3508 * functions:
3509 0
3510 $ hg debugtemplate -v '{(123)}\n'
3511 (template
3512 (group
3513 (integer '123'))
3514 (string '\n'))
3515 * keywords:
3516 * functions:
3517 123
3518 $ hg debugtemplate -v '{(-4)}\n'
3519 (template
3520 (group
3521 (negate
3522 (integer '4')))
3523 (string '\n'))
3524 * keywords:
3525 * functions:
3526 -4
3527 $ hg debugtemplate '{(-)}\n'
3528 hg: parse error at 3: not a prefix: )
3529 ({(-)}\n
3530 ^ here)
3531 [255]
3532 $ hg debugtemplate '{(-a)}\n'
3533 hg: parse error: negation needs an integer argument
3534 [255]
3535
3536 top-level integer literal is interpreted as symbol (i.e. variable name):
3537
3538 $ hg debugtemplate -D 1=one -v '{1}\n'
3539 (template
3540 (integer '1')
3541 (string '\n'))
3542 * keywords:
3543 * functions:
3544 one
3545 $ hg debugtemplate -D 1=one -v '{if("t", "{1}")}\n'
3546 (template
3547 (func
3548 (symbol 'if')
3549 (list
3550 (string 't')
3551 (template
3552 (integer '1'))))
3553 (string '\n'))
3554 * keywords:
3555 * functions: if
3556 one
3557 $ hg debugtemplate -D 1=one -v '{1|stringify}\n'
3558 (template
3559 (|
3560 (integer '1')
3561 (symbol 'stringify'))
3562 (string '\n'))
3563 * keywords:
3564 * functions: stringify
3565 one
3566
3567 unless explicit symbol is expected:
3568
3569 $ hg log -Ra -r0 -T '{desc|1}\n'
3570 hg: parse error: expected a symbol, got 'integer'
3571 [255]
3572 $ hg log -Ra -r0 -T '{1()}\n'
3573 hg: parse error: expected a symbol, got 'integer'
3574 [255]
3575
3576 Test string literal:
3577
3578 $ hg debugtemplate -Ra -r0 -v '{"string with no template fragment"}\n'
3579 (template
3580 (string 'string with no template fragment')
3581 (string '\n'))
3582 * keywords:
3583 * functions:
3584 string with no template fragment
3585 $ hg debugtemplate -Ra -r0 -v '{"template: {rev}"}\n'
3586 (template
3587 (template
3588 (string 'template: ')
3589 (symbol 'rev'))
3590 (string '\n'))
3591 * keywords: rev
3592 * functions:
3593 template: 0
3594 $ hg debugtemplate -Ra -r0 -v '{r"rawstring: {rev}"}\n'
3595 (template
3596 (string 'rawstring: {rev}')
3597 (string '\n'))
3598 * keywords:
3599 * functions:
3600 rawstring: {rev}
3601 $ hg debugtemplate -Ra -r0 -v '{files % r"rawstring: {file}"}\n'
3602 (template
3603 (%
3604 (symbol 'files')
3605 (string 'rawstring: {file}'))
3606 (string '\n'))
3607 * keywords: files
3608 * functions:
3609 rawstring: {file}
3610
3611 Test string escaping:
3612
3613 $ hg log -R latesttag -r 0 --template '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3614 >
3615 <>\n<[>
3616 <>\n<]>
3617 <>\n<
3618
3619 $ hg log -R latesttag -r 0 \
3620 > --config ui.logtemplate='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3621 >
3622 <>\n<[>
3623 <>\n<]>
3624 <>\n<
3625
3626 $ hg log -R latesttag -r 0 -T esc \
3627 > --config templates.esc='>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3628 >
3629 <>\n<[>
3630 <>\n<]>
3631 <>\n<
3632
3633 $ cat <<'EOF' > esctmpl
3634 > changeset = '>\n<>\\n<{if(rev, "[>\n<>\\n<]")}>\n<>\\n<\n'
3635 > EOF
3636 $ hg log -R latesttag -r 0 --style ./esctmpl
3637 >
3638 <>\n<[>
3639 <>\n<]>
3640 <>\n<
3641
3642 Test string escaping of quotes:
3643
3644 $ hg log -Ra -r0 -T '{"\""}\n'
3645 "
3646 $ hg log -Ra -r0 -T '{"\\\""}\n'
3647 \"
3648 $ hg log -Ra -r0 -T '{r"\""}\n'
3649 \"
3650 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3651 \\\"
3652
3653
3654 $ hg log -Ra -r0 -T '{"\""}\n'
3655 "
3656 $ hg log -Ra -r0 -T '{"\\\""}\n'
3657 \"
3658 $ hg log -Ra -r0 -T '{r"\""}\n'
3659 \"
3660 $ hg log -Ra -r0 -T '{r"\\\""}\n'
3661 \\\"
3662
3663 Test exception in quoted template. single backslash before quotation mark is
3664 stripped before parsing:
3665
3666 $ cat <<'EOF' > escquotetmpl
3667 > changeset = "\" \\" \\\" \\\\" {files % \"{file}\"}\n"
3668 > EOF
3669 $ cd latesttag
3670 $ hg log -r 2 --style ../escquotetmpl
3671 " \" \" \\" head1
3672
3673 $ hg log -r 2 -T esc --config templates.esc='"{\"valid\"}\n"'
3674 valid
3675 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
3676 valid
3677
3678 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
3679 _evalifliteral() templates (issue4733):
3680
3681 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
3682 "2
3683 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
3684 "2
3685 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
3686 "2
3687
3688 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
3689 \"
3690 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
3691 \"
3692 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3693 \"
3694
3695 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
3696 \\\"
3697 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
3698 \\\"
3699 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
3700 \\\"
3701
3702 escaped single quotes and errors:
3703
3704 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
3705 foo
3706 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
3707 foo
3708 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
3709 hg: parse error at 21: unterminated string
3710 ({if(rev, "{if(rev, \")}")}\n
3711 ^ here)
3712 [255]
3713 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
3714 hg: parse error: trailing \ in string
3715 [255]
3716 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
3717 hg: parse error: trailing \ in string
3718 [255]
3719
3720 $ cd ..
3721
3722 Test leading backslashes:
3723
3724 $ cd latesttag
3725 $ hg log -r 2 -T '\{rev} {files % "\{file}"}\n'
3726 {rev} {file}
3727 $ hg log -r 2 -T '\\{rev} {files % "\\{file}"}\n'
3728 \2 \head1
3729 $ hg log -r 2 -T '\\\{rev} {files % "\\\{file}"}\n'
3730 \{rev} \{file}
3731 $ cd ..
3732
3733 Test leading backslashes in "if" expression (issue4714):
3734
3735 $ cd latesttag
3736 $ hg log -r 2 -T '{if("1", "\{rev}")} {if("1", r"\{rev}")}\n'
3737 {rev} \{rev}
3738 $ hg log -r 2 -T '{if("1", "\\{rev}")} {if("1", r"\\{rev}")}\n'
3739 \2 \\{rev}
3740 $ hg log -r 2 -T '{if("1", "\\\{rev}")} {if("1", r"\\\{rev}")}\n'
3741 \{rev} \\\{rev}
3742 $ cd ..
3743
3744 "string-escape"-ed "\x5c\x786e" becomes r"\x6e" (once) or r"n" (twice)
3745
3746 $ hg log -R a -r 0 --template '{if("1", "\x5c\x786e", "NG")}\n'
3747 \x6e
3748 $ hg log -R a -r 0 --template '{if("1", r"\x5c\x786e", "NG")}\n'
3749 \x5c\x786e
3750 $ hg log -R a -r 0 --template '{if("", "NG", "\x5c\x786e")}\n'
3751 \x6e
3752 $ hg log -R a -r 0 --template '{if("", "NG", r"\x5c\x786e")}\n'
3753 \x5c\x786e
3754
3755 $ hg log -R a -r 2 --template '{ifeq("no perso\x6e", desc, "\x5c\x786e", "NG")}\n'
3756 \x6e
3757 $ hg log -R a -r 2 --template '{ifeq(r"no perso\x6e", desc, "NG", r"\x5c\x786e")}\n'
3758 \x5c\x786e
3759 $ hg log -R a -r 2 --template '{ifeq(desc, "no perso\x6e", "\x5c\x786e", "NG")}\n'
3760 \x6e
3761 $ hg log -R a -r 2 --template '{ifeq(desc, r"no perso\x6e", "NG", r"\x5c\x786e")}\n'
3762 \x5c\x786e
3763
3764 $ hg log -R a -r 8 --template '{join(files, "\n")}\n'
3765 fourth
3766 second
3767 third
3768 $ hg log -R a -r 8 --template '{join(files, r"\n")}\n'
3769 fourth\nsecond\nthird
3770
3771 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", "htm\x6c")}'
3772 <p>
3773 1st
3774 </p>
3775 <p>
3776 2nd
3777 </p>
3778 $ hg log -R a -r 2 --template '{rstdoc(r"1st\n\n2nd", "html")}'
3779 <p>
3780 1st\n\n2nd
3781 </p>
3782 $ hg log -R a -r 2 --template '{rstdoc("1st\n\n2nd", r"htm\x6c")}'
3783 1st
3784
3785 2nd
3786
3787 $ hg log -R a -r 2 --template '{strip(desc, "\x6e")}\n'
3788 o perso
3789 $ hg log -R a -r 2 --template '{strip(desc, r"\x6e")}\n'
3790 no person
3791 $ hg log -R a -r 2 --template '{strip("no perso\x6e", "\x6e")}\n'
3792 o perso
3793 $ hg log -R a -r 2 --template '{strip(r"no perso\x6e", r"\x6e")}\n'
3794 no perso
3795
3796 $ hg log -R a -r 2 --template '{sub("\\x6e", "\x2d", desc)}\n'
3797 -o perso-
3798 $ hg log -R a -r 2 --template '{sub(r"\\x6e", "-", desc)}\n'
3799 no person
3800 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", desc)}\n'
3801 \x2do perso\x2d
3802 $ hg log -R a -r 2 --template '{sub("n", "\x2d", "no perso\x6e")}\n'
3803 -o perso-
3804 $ hg log -R a -r 2 --template '{sub("n", r"\x2d", r"no perso\x6e")}\n'
3805 \x2do perso\x6e
3806
3807 $ hg log -R a -r 8 --template '{files % "{file}\n"}'
3808 fourth
3809 second
3810 third
3811
3812 Test string escaping in nested expression:
3813
3814 $ hg log -R a -r 8 --template '{ifeq(r"\x6e", if("1", "\x5c\x786e"), join(files, "\x5c\x786e"))}\n'
3815 fourth\x6esecond\x6ethird
3816 $ hg log -R a -r 8 --template '{ifeq(if("1", r"\x6e"), "\x5c\x786e", join(files, "\x5c\x786e"))}\n'
3817 fourth\x6esecond\x6ethird
3818
3819 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", "\x5c\x786e"))}\n'
3820 fourth\x6esecond\x6ethird
3821 $ hg log -R a -r 8 --template '{join(files, ifeq(branch, "default", r"\x5c\x786e"))}\n'
3822 fourth\x5c\x786esecond\x5c\x786ethird
3823
3824 $ hg log -R a -r 3:4 --template '{rev}:{sub(if("1", "\x6e"), ifeq(branch, "foo", r"\x5c\x786e", "\x5c\x786e"), desc)}\n'
3825 3:\x6eo user, \x6eo domai\x6e
3826 4:\x5c\x786eew bra\x5c\x786ech
3827
3828 Test quotes in nested expression are evaluated just like a $(command)
3829 substitution in POSIX shells:
3830
3831 $ hg log -R a -r 8 -T '{"{"{rev}:{node|short}"}"}\n'
3832 8:95c24699272e
3833 $ hg log -R a -r 8 -T '{"{"\{{rev}} \"{node|short}\""}"}\n'
3834 {8} "95c24699272e"
3835
3836 Test recursive evaluation:
3837
3838 $ hg init r
3839 $ cd r
3840 $ echo a > a
3841 $ hg ci -Am '{rev}'
3842 adding a
3843 $ hg log -r 0 --template '{if(rev, desc)}\n'
3844 {rev}
3845 $ hg log -r 0 --template '{if(rev, "{author} {rev}")}\n'
3846 test 0
3847
3848 $ hg branch -q 'text.{rev}'
3849 $ echo aa >> aa
3850 $ hg ci -u '{node|short}' -m 'desc to be wrapped desc to be wrapped'
3851
3852 $ hg log -l1 --template '{fill(desc, "20", author, branch)}'
3853 {node|short}desc to
3854 text.{rev}be wrapped
3855 text.{rev}desc to be
3856 text.{rev}wrapped (no-eol)
3857 $ hg log -l1 --template '{fill(desc, "20", "{node|short}:", "text.{rev}:")}'
3858 bcc7ff960b8e:desc to
3859 text.1:be wrapped
3860 text.1:desc to be
3861 text.1:wrapped (no-eol)
3862 $ hg log -l1 -T '{fill(desc, date, "", "")}\n'
3863 hg: parse error: fill expects an integer width
3864 [255]
3865
3866 $ COLUMNS=25 hg log -l1 --template '{fill(desc, termwidth, "{node|short}:", "termwidth.{rev}:")}'
3867 bcc7ff960b8e:desc to be
3868 termwidth.1:wrapped desc
3869 termwidth.1:to be wrapped (no-eol)
3870
3871 $ hg log -l 1 --template '{sub(r"[0-9]", "-", author)}'
3872 {node|short} (no-eol)
3873 $ hg log -l 1 --template '{sub(r"[0-9]", "-", "{node|short}")}'
3874 bcc-ff---b-e (no-eol)
3875
3876 $ cat >> .hg/hgrc <<EOF
3877 > [extensions]
3878 > color=
3879 > [color]
3880 > mode=ansi
3881 > text.{rev} = red
3882 > text.1 = green
3883 > EOF
3884 $ hg log --color=always -l 1 --template '{label(branch, "text\n")}'
3885 \x1b[0;31mtext\x1b[0m (esc)
3886 $ hg log --color=always -l 1 --template '{label("text.{rev}", "text\n")}'
3887 \x1b[0;32mtext\x1b[0m (esc)
3888
3889 color effect can be specified without quoting:
3890
3891 $ hg log --color=always -l 1 --template '{label(red, "text\n")}'
3892 \x1b[0;31mtext\x1b[0m (esc)
3893
3894 color effects can be nested (issue5413)
3895
3896 $ hg debugtemplate --color=always \
3897 > '{label(red, "red{label(magenta, "ma{label(cyan, "cyan")}{label(yellow, "yellow")}genta")}")}\n'
3898 \x1b[0;31mred\x1b[0;35mma\x1b[0;36mcyan\x1b[0m\x1b[0;31m\x1b[0;35m\x1b[0;33myellow\x1b[0m\x1b[0;31m\x1b[0;35mgenta\x1b[0m (esc)
3899
3900 pad() should interact well with color codes (issue5416)
3901
3902 $ hg debugtemplate --color=always \
3903 > '{pad(label(red, "red"), 5, label(cyan, "-"))}\n'
3904 \x1b[0;31mred\x1b[0m\x1b[0;36m-\x1b[0m\x1b[0;36m-\x1b[0m (esc)
3905
3906 label should be no-op if color is disabled:
3907
3908 $ hg log --color=never -l 1 --template '{label(red, "text\n")}'
3909 text
3910 $ hg log --config extensions.color=! -l 1 --template '{label(red, "text\n")}'
3911 text
3912
3913 Test branches inside if statement:
3914
3915 $ hg log -r 0 --template '{if(branches, "yes", "no")}\n'
3916 no
3917
3918 Test dict constructor:
3919
3920 $ hg log -r 0 -T '{dict(y=node|short, x=rev)}\n'
3921 y=f7769ec2ab97 x=0
3922 $ hg log -r 0 -T '{dict(x=rev, y=node|short) % "{key}={value}\n"}'
3923 x=0
3924 y=f7769ec2ab97
3925 $ hg log -r 0 -T '{dict(x=rev, y=node|short)|json}\n'
3926 {"x": 0, "y": "f7769ec2ab97"}
3927 $ hg log -r 0 -T '{dict()|json}\n'
3928 {}
3929
3930 $ hg log -r 0 -T '{dict(rev, node=node|short)}\n'
3931 rev=0 node=f7769ec2ab97
3932 $ hg log -r 0 -T '{dict(rev, node|short)}\n'
3933 rev=0 node=f7769ec2ab97
3934
3935 $ hg log -r 0 -T '{dict(rev, rev=rev)}\n'
3936 hg: parse error: duplicated dict key 'rev' inferred
3937 [255]
3938 $ hg log -r 0 -T '{dict(node, node|short)}\n'
3939 hg: parse error: duplicated dict key 'node' inferred
3940 [255]
3941 $ hg log -r 0 -T '{dict(1 + 2)}'
3942 hg: parse error: dict key cannot be inferred
3943 [255]
3944
3945 $ hg log -r 0 -T '{dict(x=rev, x=node)}'
3946 hg: parse error: dict got multiple values for keyword argument 'x'
3947 [255]
3948
3949 Test get function:
3950
3951 $ hg log -r 0 --template '{get(extras, "branch")}\n'
3952 default
3953 $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n'
3954 default
3955 $ hg log -r 0 --template '{get(files, "should_fail")}\n'
3956 hg: parse error: not a dictionary
3957 (get() expects a dict as first argument)
3958 [255]
3959
3960 Test json filter applied to wrapped object:
3961
3962 $ hg log -r0 -T '{files|json}\n'
3963 ["a"]
3964 $ hg log -r0 -T '{extras|json}\n'
3965 {"branch": "default"}
3966 $ hg log -r0 -T '{date|json}\n'
3967 [0, 0]
3968
3969 Test json filter applied to map result:
3970
3971 $ hg log -r0 -T '{json(extras % "{key}")}\n'
3972 ["branch"]
3973
3974 Test localdate(date, tz) function:
3975
3976 $ TZ=JST-09 hg log -r0 -T '{date|localdate|isodate}\n'
3977 1970-01-01 09:00 +0900
3978 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "UTC")|isodate}\n'
3979 1970-01-01 00:00 +0000
3980 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "blahUTC")|isodate}\n'
3981 hg: parse error: localdate expects a timezone
3982 [255]
3983 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "+0200")|isodate}\n'
3984 1970-01-01 02:00 +0200
3985 $ TZ=JST-09 hg log -r0 -T '{localdate(date, "0")|isodate}\n'
3986 1970-01-01 00:00 +0000
3987 $ TZ=JST-09 hg log -r0 -T '{localdate(date, 0)|isodate}\n'
3988 1970-01-01 00:00 +0000
3989 $ hg log -r0 -T '{localdate(date, "invalid")|isodate}\n'
3990 hg: parse error: localdate expects a timezone
3991 [255]
3992 $ hg log -r0 -T '{localdate(date, date)|isodate}\n'
3993 hg: parse error: localdate expects a timezone
3994 [255]
3995
3996 Test shortest(node) function:
3997
3998 $ echo b > b
3999 $ hg ci -qAm b
4000 $ hg log --template '{shortest(node)}\n'
4001 e777
4002 bcc7
4003 f776
4004 $ hg log --template '{shortest(node, 10)}\n'
4005 e777603221
4006 bcc7ff960b
4007 f7769ec2ab
4008 $ hg log --template '{node|shortest}\n' -l1
4009 e777
4010
4011 $ hg log -r 0 -T '{shortest(node, "1{"0"}")}\n'
4012 f7769ec2ab
4013 $ hg log -r 0 -T '{shortest(node, "not an int")}\n'
4014 hg: parse error: shortest() expects an integer minlength
4015 [255]
4016
4017 $ hg log -r 'wdir()' -T '{node|shortest}\n'
4018 ffff
4019
4020 $ hg log --template '{shortest("f")}\n' -l1
4021 f
4022
4023 $ hg log --template '{shortest("0123456789012345678901234567890123456789")}\n' -l1
4024 0123456789012345678901234567890123456789
4025
4026 $ hg log --template '{shortest("01234567890123456789012345678901234567890123456789")}\n' -l1
4027 01234567890123456789012345678901234567890123456789
4028
4029 $ hg log --template '{shortest("not a hex string")}\n' -l1
4030 not a hex string
4031
4032 $ hg log --template '{shortest("not a hex string, but it'\''s 40 bytes long")}\n' -l1
4033 not a hex string, but it's 40 bytes long
4034
4035 $ hg log --template '{shortest("ffffffffffffffffffffffffffffffffffffffff")}\n' -l1
4036 ffff
4037
4038 $ hg log --template '{shortest("fffffff")}\n' -l1
4039 ffff
4040
4041 $ hg log --template '{shortest("ff")}\n' -l1
4042 ffff
4043
4044 $ cd ..
4045
4046 Test shortest(node) with the repo having short hash collision:
4047
4048 $ hg init hashcollision
4049 $ cd hashcollision
4050 $ cat <<EOF >> .hg/hgrc
4051 > [experimental]
4052 > evolution.createmarkers=True
4053 > EOF
4054 $ echo 0 > a
4055 $ hg ci -qAm 0
4056 $ for i in 17 129 248 242 480 580 617 1057 2857 4025; do
4057 > hg up -q 0
4058 > echo $i > a
4059 > hg ci -qm $i
4060 > done
4061 $ hg up -q null
4062 $ hg log -r0: -T '{rev}:{node}\n'
4063 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a
4064 1:11424df6dc1dd4ea255eae2b58eaca7831973bbc
4065 2:11407b3f1b9c3e76a79c1ec5373924df096f0499
4066 3:11dd92fe0f39dfdaacdaa5f3997edc533875cfc4
4067 4:10776689e627b465361ad5c296a20a487e153ca4
4068 5:a00be79088084cb3aff086ab799f8790e01a976b
4069 6:a0b0acd79b4498d0052993d35a6a748dd51d13e6
4070 7:a0457b3450b8e1b778f1163b31a435802987fe5d
4071 8:c56256a09cd28e5764f32e8e2810d0f01e2e357a
4072 9:c5623987d205cd6d9d8389bfc40fff9dbb670b48
4073 10:c562ddd9c94164376c20b86b0b4991636a3bf84f
4074 $ hg debugobsolete a00be79088084cb3aff086ab799f8790e01a976b
4075 obsoleted 1 changesets
4076 $ hg debugobsolete c5623987d205cd6d9d8389bfc40fff9dbb670b48
4077 obsoleted 1 changesets
4078 $ hg debugobsolete c562ddd9c94164376c20b86b0b4991636a3bf84f
4079 obsoleted 1 changesets
4080
4081 nodes starting with '11' (we don't have the revision number '11' though)
4082
4083 $ hg log -r 1:3 -T '{rev}:{shortest(node, 0)}\n'
4084 1:1142
4085 2:1140
4086 3:11d
4087
4088 '5:a00' is hidden, but still we have two nodes starting with 'a0'
4089
4090 $ hg log -r 6:7 -T '{rev}:{shortest(node, 0)}\n'
4091 6:a0b
4092 7:a04
4093
4094 node '10' conflicts with the revision number '10' even if it is hidden
4095 (we could exclude hidden revision numbers, but currently we don't)
4096
4097 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n'
4098 4:107
4099 $ hg log -r 4 -T '{rev}:{shortest(node, 0)}\n' --hidden
4100 4:107
4101
4102 node 'c562' should be unique if the other 'c562' nodes are hidden
4103 (but we don't try the slow path to filter out hidden nodes for now)
4104
4105 $ hg log -r 8 -T '{rev}:{node|shortest}\n'
4106 8:c5625
4107 $ hg log -r 8:10 -T '{rev}:{node|shortest}\n' --hidden
4108 8:c5625
4109 9:c5623
4110 10:c562d
4111
4112 $ cd ..
4113
4114 Test pad function
4115
4116 $ cd r
4117
4118 $ hg log --template '{pad(rev, 20)} {author|user}\n'
4119 2 test
4120 1 {node|short}
4121 0 test
4122
4123 $ hg log --template '{pad(rev, 20, " ", True)} {author|user}\n'
4124 2 test
4125 1 {node|short}
4126 0 test
4127
4128 $ hg log --template '{pad(rev, 20, "-", False)} {author|user}\n'
4129 2------------------- test
4130 1------------------- {node|short}
4131 0------------------- test
4132
4133 Test template string in pad function
4134
4135 $ hg log -r 0 -T '{pad("\{{rev}}", 10)} {author|user}\n'
4136 {0} test
4137
4138 $ hg log -r 0 -T '{pad(r"\{rev}", 10)} {author|user}\n'
4139 \{rev} test
4140
4141 Test width argument passed to pad function
4142
4143 $ hg log -r 0 -T '{pad(rev, "1{"0"}")} {author|user}\n'
4144 0 test
4145 $ hg log -r 0 -T '{pad(rev, "not an int")}\n'
4146 hg: parse error: pad() expects an integer width
4147 [255]
4148
4149 Test invalid fillchar passed to pad function
4150
4151 $ hg log -r 0 -T '{pad(rev, 10, "")}\n'
4152 hg: parse error: pad() expects a single fill character
4153 [255]
4154 $ hg log -r 0 -T '{pad(rev, 10, "--")}\n'
4155 hg: parse error: pad() expects a single fill character
4156 [255]
4157
4158 Test boolean argument passed to pad function
4159
4160 no crash
4161
4162 $ hg log -r 0 -T '{pad(rev, 10, "-", "f{"oo"}")}\n'
4163 ---------0
4164
4165 string/literal
4166
4167 $ hg log -r 0 -T '{pad(rev, 10, "-", "false")}\n'
4168 ---------0
4169 $ hg log -r 0 -T '{pad(rev, 10, "-", false)}\n'
4170 0---------
4171 $ hg log -r 0 -T '{pad(rev, 10, "-", "")}\n'
4172 0---------
4173
4174 unknown keyword is evaluated to ''
4175
4176 $ hg log -r 0 -T '{pad(rev, 10, "-", unknownkeyword)}\n'
4177 0---------
4178
4179 Test separate function
4180
4181 $ hg log -r 0 -T '{separate("-", "", "a", "b", "", "", "c", "")}\n'
4182 a-b-c
4183 $ hg log -r 0 -T '{separate(" ", "{rev}:{node|short}", author|user, branch)}\n'
4184 0:f7769ec2ab97 test default
4185 $ hg log -r 0 --color=always -T '{separate(" ", "a", label(red, "b"), "c", label(red, ""), "d")}\n'
4186 a \x1b[0;31mb\x1b[0m c d (esc)
4187
4188 Test boolean expression/literal passed to if function
4189
4190 $ hg log -r 0 -T '{if(rev, "rev 0 is True")}\n'
4191 rev 0 is True
4192 $ hg log -r 0 -T '{if(0, "literal 0 is True as well")}\n'
4193 literal 0 is True as well
4194 $ hg log -r 0 -T '{if("", "", "empty string is False")}\n'
4195 empty string is False
4196 $ hg log -r 0 -T '{if(revset(r"0 - 0"), "", "empty list is False")}\n'
4197 empty list is False
4198 $ hg log -r 0 -T '{if(revset(r"0"), "non-empty list is True")}\n'
4199 non-empty list is True
4200 $ hg log -r 0 -T '{if(revset(r"0") % "", "list of empty strings is True")}\n'
4201 list of empty strings is True
4202 $ hg log -r 0 -T '{if(true, "true is True")}\n'
4203 true is True
4204 $ hg log -r 0 -T '{if(false, "", "false is False")}\n'
4205 false is False
4206 $ hg log -r 0 -T '{if("false", "non-empty string is True")}\n'
4207 non-empty string is True
4208
4209 Test ifcontains function
4210
4211 $ hg log --template '{rev} {ifcontains(rev, "2 two 0", "is in the string", "is not")}\n'
4212 2 is in the string
4213 1 is not
4214 0 is in the string
4215
4216 $ hg log -T '{rev} {ifcontains(rev, "2 two{" 0"}", "is in the string", "is not")}\n'
4217 2 is in the string
4218 1 is not
4219 0 is in the string
4220
4221 $ hg log --template '{rev} {ifcontains("a", file_adds, "added a", "did not add a")}\n'
4222 2 did not add a
4223 1 did not add a
4224 0 added a
4225
4226 $ hg log --debug -T '{rev}{ifcontains(1, parents, " is parent of 1")}\n'
4227 2 is parent of 1
4228 1
4229 0
4230
4231 $ hg log -l1 -T '{ifcontains("branch", extras, "t", "f")}\n'
4232 t
4233 $ hg log -l1 -T '{ifcontains("branch", extras % "{key}", "t", "f")}\n'
4234 t
4235 $ hg log -l1 -T '{ifcontains("branc", extras % "{key}", "t", "f")}\n'
4236 f
4237 $ hg log -l1 -T '{ifcontains("branc", stringify(extras % "{key}"), "t", "f")}\n'
4238 t
4239
4240 Test revset function
4241
4242 $ hg log --template '{rev} {ifcontains(rev, revset("."), "current rev", "not current rev")}\n'
4243 2 current rev
4244 1 not current rev
4245 0 not current rev
4246
4247 $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
4248 2 match rev
4249 1 match rev
4250 0 not match rev
4251
4252 $ hg log -T '{ifcontains(desc, revset(":"), "", "type not match")}\n' -l1
4253 type not match
4254
4255 $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
4256 2 Parents: 1
4257 1 Parents: 0
4258 0 Parents:
4259
4260 $ cat >> .hg/hgrc <<EOF
4261 > [revsetalias]
4262 > myparents(\$1) = parents(\$1)
4263 > EOF
4264 $ hg log --template '{rev} Parents: {revset("myparents(%s)", rev)}\n'
4265 2 Parents: 1
4266 1 Parents: 0
4267 0 Parents:
4268
4269 $ hg log --template 'Rev: {rev}\n{revset("::%s", rev) % "Ancestor: {revision}\n"}\n'
4270 Rev: 2
4271 Ancestor: 0
4272 Ancestor: 1
4273 Ancestor: 2
4274
4275 Rev: 1
4276 Ancestor: 0
4277 Ancestor: 1
4278
4279 Rev: 0
4280 Ancestor: 0
4281
4282 $ hg log --template '{revset("TIP"|lower)}\n' -l1
4283 2
4284
4285 $ hg log -T '{revset("%s", "t{"ip"}")}\n' -l1
4286 2
4287
4288 a list template is evaluated for each item of revset/parents
4289
4290 $ hg log -T '{rev} p: {revset("p1(%s)", rev) % "{rev}:{node|short}"}\n'
4291 2 p: 1:bcc7ff960b8e
4292 1 p: 0:f7769ec2ab97
4293 0 p:
4294
4295 $ hg log --debug -T '{rev} p:{parents % " {rev}:{node|short}"}\n'
4296 2 p: 1:bcc7ff960b8e -1:000000000000
4297 1 p: 0:f7769ec2ab97 -1:000000000000
4298 0 p: -1:000000000000 -1:000000000000
4299
4300 therefore, 'revcache' should be recreated for each rev
4301
4302 $ hg log -T '{rev} {file_adds}\np {revset("p1(%s)", rev) % "{file_adds}"}\n'
4303 2 aa b
4304 p
4305 1
4306 p a
4307 0 a
4308 p
4309
4310 $ hg log --debug -T '{rev} {file_adds}\np {parents % "{file_adds}"}\n'
4311 2 aa b
4312 p
4313 1
4314 p a
4315 0 a
4316 p
4317
4318 a revset item must be evaluated as an integer revision, not an offset from tip
4319
4320 $ hg log -l 1 -T '{revset("null") % "{rev}:{node|short}"}\n'
4321 -1:000000000000
4322 $ hg log -l 1 -T '{revset("%s", "null") % "{rev}:{node|short}"}\n'
4323 -1:000000000000
4324
4325 join() should pick '{rev}' from revset items:
4326
4327 $ hg log -R ../a -T '{join(revset("parents(%d)", rev), ", ")}\n' -r6
4328 4, 5
4329
4330 on the other hand, parents are formatted as '{rev}:{node|formatnode}' by
4331 default. join() should agree with the default formatting:
4332
4333 $ hg log -R ../a -T '{join(parents, ", ")}\n' -r6
4334 5:13207e5a10d9, 4:bbe44766e73d
4335
4336 $ hg log -R ../a -T '{join(parents, ",\n")}\n' -r6 --debug
4337 5:13207e5a10d9fd28ec424934298e176197f2c67f,
4338 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74
4339
4340 Invalid arguments passed to revset()
4341
4342 $ hg log -T '{revset("%whatever", 0)}\n'
4343 hg: parse error: unexpected revspec format character w
4344 [255]
4345 $ hg log -T '{revset("%lwhatever", files)}\n'
4346 hg: parse error: unexpected revspec format character w
4347 [255]
4348 $ hg log -T '{revset("%s %s", 0)}\n'
4349 hg: parse error: missing argument for revspec
4350 [255]
4351 $ hg log -T '{revset("", 0)}\n'
4352 hg: parse error: too many revspec arguments specified
4353 [255]
4354 $ hg log -T '{revset("%s", 0, 1)}\n'
4355 hg: parse error: too many revspec arguments specified
4356 [255]
4357 $ hg log -T '{revset("%", 0)}\n'
4358 hg: parse error: incomplete revspec format character
4359 [255]
4360 $ hg log -T '{revset("%l", 0)}\n'
4361 hg: parse error: incomplete revspec format character
4362 [255]
4363 $ hg log -T '{revset("%d", 'foo')}\n'
4364 hg: parse error: invalid argument for revspec
4365 [255]
4366 $ hg log -T '{revset("%ld", files)}\n'
4367 hg: parse error: invalid argument for revspec
4368 [255]
4369 $ hg log -T '{revset("%ls", 0)}\n'
4370 hg: parse error: invalid argument for revspec
4371 [255]
4372 $ hg log -T '{revset("%b", 'foo')}\n'
4373 hg: parse error: invalid argument for revspec
4374 [255]
4375 $ hg log -T '{revset("%lb", files)}\n'
4376 hg: parse error: invalid argument for revspec
4377 [255]
4378 $ hg log -T '{revset("%r", 0)}\n'
4379 hg: parse error: invalid argument for revspec
4380 [255]
4381
4382 Test 'originalnode'
4383
4384 $ hg log -r 1 -T '{revset("null") % "{node|short} {originalnode|short}"}\n'
4385 000000000000 bcc7ff960b8e
4386 $ hg log -r 0 -T '{manifest % "{node} {originalnode}"}\n'
4387 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 f7769ec2ab975ad19684098ad1ffd9b81ecc71a1
4388
4389 Test files function
4390
4391 $ hg log -T "{rev}\n{join(files('*'), '\n')}\n"
4392 2
4393 a
4394 aa
4395 b
4396 1
4397 a
4398 0
4399 a
4400
4401 $ hg log -T "{rev}\n{join(files('aa'), '\n')}\n"
4402 2
4403 aa
4404 1
4405
4406 0
4407
4408 $ hg rm a
4409 $ hg log -r "wdir()" -T "{rev}\n{join(files('*'), '\n')}\n"
4410 2147483647
4411 aa
4412 b
4413 $ hg revert a
4414
4415 Test relpath function
4416
4417 $ hg log -r0 -T '{files % "{file|relpath}\n"}'
4418 a
4419 $ cd ..
4420 $ hg log -R r -r0 -T '{files % "{file|relpath}\n"}'
4421 r/a
4422 $ cd r
4423
4424 Test active bookmark templating
4425
4426 $ hg book foo
4427 $ hg book bar
4428 $ hg log --template "{rev} {bookmarks % '{bookmark}{ifeq(bookmark, active, \"*\")} '}\n"
4429 2 bar* foo
4430 1
4431 0
4432 $ hg log --template "{rev} {activebookmark}\n"
4433 2 bar
4434 1
4435 0
4436 $ hg bookmarks --inactive bar
4437 $ hg log --template "{rev} {activebookmark}\n"
4438 2
4439 1
4440 0
4441 $ hg book -r1 baz
4442 $ hg log --template "{rev} {join(bookmarks, ' ')}\n"
4443 2 bar foo
4444 1 baz
4445 0
4446 $ hg log --template "{rev} {ifcontains('foo', bookmarks, 't', 'f')}\n"
4447 2 t
4448 1 f
4449 0 f
4450
4451 Test namespaces dict
4452
4453 $ hg --config extensions.revnamesext=$TESTDIR/revnamesext.py log -T '{rev}\n{namespaces % " {namespace} color={colorname} builtin={builtin}\n {join(names, ",")}\n"}\n'
4454 2
4455 bookmarks color=bookmark builtin=True
4456 bar,foo
4457 tags color=tag builtin=True
4458 tip
4459 branches color=branch builtin=True
4460 text.{rev}
4461 revnames color=revname builtin=False
4462 r2
4463
4464 1
4465 bookmarks color=bookmark builtin=True
4466 baz
4467 tags color=tag builtin=True
4468
4469 branches color=branch builtin=True
4470 text.{rev}
4471 revnames color=revname builtin=False
4472 r1
4473
4474 0
4475 bookmarks color=bookmark builtin=True
4476
4477 tags color=tag builtin=True
4478
4479 branches color=branch builtin=True
4480 default
4481 revnames color=revname builtin=False
4482 r0
4483
4484 $ hg log -r2 -T '{namespaces % "{namespace}: {names}\n"}'
4485 bookmarks: bar foo
4486 tags: tip
4487 branches: text.{rev}
4488 $ hg log -r2 -T '{namespaces % "{namespace}:\n{names % " {name}\n"}"}'
4489 bookmarks:
4490 bar
4491 foo
4492 tags:
4493 tip
4494 branches:
4495 text.{rev}
4496 $ hg log -r2 -T '{get(namespaces, "bookmarks") % "{name}\n"}'
4497 bar
4498 foo
4499 $ hg log -r2 -T '{namespaces.bookmarks % "{bookmark}\n"}'
4500 bar
4501 foo
4502
4503 Test stringify on sub expressions
4504
4505 $ cd ..
4506 $ hg log -R a -r 8 --template '{join(files, if("1", if("1", ", ")))}\n'
4507 fourth, second, third
4508 $ hg log -R a -r 8 --template '{strip(if("1", if("1", "-abc-")), if("1", if("1", "-")))}\n'
4509 abc
4510
4511 Test splitlines
4512
4513 $ hg log -Gv -R a --template "{splitlines(desc) % 'foo {line}\n'}"
4514 @ foo Modify, add, remove, rename
4515 |
4516 o foo future
4517 |
4518 o foo third
4519 |
4520 o foo second
4521
4522 o foo merge
4523 |\
4524 | o foo new head
4525 | |
4526 o | foo new branch
4527 |/
4528 o foo no user, no domain
4529 |
4530 o foo no person
4531 |
4532 o foo other 1
4533 | foo other 2
4534 | foo
4535 | foo other 3
4536 o foo line 1
4537 foo line 2
4538
4539 $ hg log -R a -r0 -T '{desc|splitlines}\n'
4540 line 1 line 2
4541 $ hg log -R a -r0 -T '{join(desc|splitlines, "|")}\n'
4542 line 1|line 2
4543
4544 Test startswith
4545 $ hg log -Gv -R a --template "{startswith(desc)}"
4546 hg: parse error: startswith expects two arguments
4547 [255]
4548
4549 $ hg log -Gv -R a --template "{startswith('line', desc)}"
4550 @
4551 |
4552 o
4553 |
4554 o
4555 |
4556 o
4557
4558 o
4559 |\
4560 | o
4561 | |
4562 o |
4563 |/
4564 o
4565 |
4566 o
4567 |
4568 o
4569 |
4570 o line 1
4571 line 2
4572
4573 Test bad template with better error message
4574
4575 $ hg log -Gv -R a --template '{desc|user()}'
4576 hg: parse error: expected a symbol, got 'func'
4577 [255]
4578
4579 Test word function (including index out of bounds graceful failure)
4580
4581 $ hg log -Gv -R a --template "{word('1', desc)}"
4582 @ add,
4583 |
4584 o
4585 |
4586 o
4587 |
4588 o
4589
4590 o
4591 |\
4592 | o head
4593 | |
4594 o | branch
4595 |/
4596 o user,
4597 |
4598 o person
4599 |
4600 o 1
4601 |
4602 o 1
4603
4604
4605 Test word third parameter used as splitter
4606
4607 $ hg log -Gv -R a --template "{word('0', desc, 'o')}"
4608 @ M
4609 |
4610 o future
4611 |
4612 o third
4613 |
4614 o sec
4615
4616 o merge
4617 |\
4618 | o new head
4619 | |
4620 o | new branch
4621 |/
4622 o n
4623 |
4624 o n
4625 |
4626 o
4627 |
4628 o line 1
4629 line 2
4630
4631 Test word error messages for not enough and too many arguments
4632
4633 $ hg log -Gv -R a --template "{word('0')}"
4634 hg: parse error: word expects two or three arguments, got 1
4635 [255]
4636
4637 $ hg log -Gv -R a --template "{word('0', desc, 'o', 'h', 'b', 'o', 'y')}"
4638 hg: parse error: word expects two or three arguments, got 7
4639 [255]
4640
4641 Test word for integer literal
4642
4643 $ hg log -R a --template "{word(2, desc)}\n" -r0
4644 line
4645
4646 Test word for invalid numbers
4647
4648 $ hg log -Gv -R a --template "{word('a', desc)}"
4649 hg: parse error: word expects an integer index
4650 [255]
4651
4652 Test word for out of range
4653
4654 $ hg log -R a --template "{word(10000, desc)}"
4655 $ hg log -R a --template "{word(-10000, desc)}"
4656
4657 Test indent and not adding to empty lines
4658
4659 $ hg log -T "-----\n{indent(desc, '>> ', ' > ')}\n" -r 0:1 -R a
4660 -----
4661 > line 1
4662 >> line 2
4663 -----
4664 > other 1
4665 >> other 2
4666
4667 >> other 3
4668
4669 Test with non-strings like dates
4670
4671 $ hg log -T "{indent(date, ' ')}\n" -r 2:3 -R a
4672 1200000.00
4673 1300000.00
4674
4675 Test broken string escapes:
4676
4677 $ hg log -T "bogus\\" -R a
4678 hg: parse error: trailing \ in string
4679 [255]
4680 $ hg log -T "\\xy" -R a
4681 hg: parse error: invalid \x escape* (glob)
4682 [255]
4683
4684 json filter should escape HTML tags so that the output can be embedded in hgweb:
4685
4686 $ hg log -T "{'<foo@example.org>'|json}\n" -R a -l1
4687 "\u003cfoo@example.org\u003e"
4688
4689 Templater supports aliases of symbol and func() styles:
4690
4691 $ hg clone -q a aliases
4692 $ cd aliases
4693 $ cat <<EOF >> .hg/hgrc
4694 > [templatealias]
4695 > r = rev
4696 > rn = "{r}:{node|short}"
4697 > status(c, files) = files % "{c} {file}\n"
4698 > utcdate(d) = localdate(d, "UTC")
4699 > EOF
4700
4701 $ hg debugtemplate -vr0 '{rn} {utcdate(date)|isodate}\n'
4702 (template
4703 (symbol 'rn')
4704 (string ' ')
4705 (|
4706 (func
4707 (symbol 'utcdate')
4708 (symbol 'date'))
4709 (symbol 'isodate'))
4710 (string '\n'))
4711 * expanded:
4712 (template
4713 (template
4714 (symbol 'rev')
4715 (string ':')
4716 (|
4717 (symbol 'node')
4718 (symbol 'short')))
4719 (string ' ')
4720 (|
4721 (func
4722 (symbol 'localdate')
4723 (list
4724 (symbol 'date')
4725 (string 'UTC')))
4726 (symbol 'isodate'))
4727 (string '\n'))
4728 * keywords: date, node, rev
4729 * functions: isodate, localdate, short
4730 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4731
4732 $ hg debugtemplate -vr0 '{status("A", file_adds)}'
4733 (template
4734 (func
4735 (symbol 'status')
4736 (list
4737 (string 'A')
4738 (symbol 'file_adds'))))
4739 * expanded:
4740 (template
4741 (%
4742 (symbol 'file_adds')
4743 (template
4744 (string 'A')
4745 (string ' ')
4746 (symbol 'file')
4747 (string '\n'))))
4748 * keywords: file, file_adds
4749 * functions:
4750 A a
4751
4752 A unary function alias can be called as a filter:
4753
4754 $ hg debugtemplate -vr0 '{date|utcdate|isodate}\n'
4755 (template
4756 (|
4757 (|
4758 (symbol 'date')
4759 (symbol 'utcdate'))
4760 (symbol 'isodate'))
4761 (string '\n'))
4762 * expanded:
4763 (template
4764 (|
4765 (func
4766 (symbol 'localdate')
4767 (list
4768 (symbol 'date')
4769 (string 'UTC')))
4770 (symbol 'isodate'))
4771 (string '\n'))
4772 * keywords: date
4773 * functions: isodate, localdate
4774 1970-01-12 13:46 +0000
4775
4776 Aliases should be applied only to command arguments and templates in hgrc.
4777 Otherwise, our stock styles and web templates could be corrupted:
4778
4779 $ hg log -r0 -T '{rn} {utcdate(date)|isodate}\n'
4780 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4781
4782 $ hg log -r0 --config ui.logtemplate='"{rn} {utcdate(date)|isodate}\n"'
4783 0:1e4e1b8f71e0 1970-01-12 13:46 +0000
4784
4785 $ cat <<EOF > tmpl
4786 > changeset = 'nothing expanded:{rn}\n'
4787 > EOF
4788 $ hg log -r0 --style ./tmpl
4789 nothing expanded:
4790
4791 Aliases in formatter:
4792
4793 $ hg branches -T '{pad(branch, 7)} {rn}\n'
4794 default 6:d41e714fe50d
4795 foo 4:bbe44766e73d
4796
4797 Aliases should honor HGPLAIN:
4798
4799 $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n'
4800 nothing expanded:
4801 $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n'
4802 0:1e4e1b8f71e0
4803
4804 Unparsable alias:
4805
4806 $ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
4807 (template
4808 (symbol 'bad'))
4809 abort: bad definition of template alias "bad": at 2: not a prefix: end
4810 [255]
4811 $ hg log --config templatealias.bad='x(' -T '{bad}'
4812 abort: bad definition of template alias "bad": at 2: not a prefix: end
4813 [255]
4814
4815 $ cd ..
4816
4817 Set up repository for non-ascii encoding tests:
4818
4819 $ hg init nonascii
4820 $ cd nonascii
4821 $ $PYTHON <<EOF
4822 > open('latin1', 'wb').write(b'\xe9')
4823 > open('utf-8', 'wb').write(b'\xc3\xa9')
4824 > EOF
4825 $ HGENCODING=utf-8 hg branch -q `cat utf-8`
4826 $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8
4827
4828 json filter should try round-trip conversion to utf-8:
4829
4830 $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0
4831 "\u00e9"
4832 $ HGENCODING=ascii hg log -T "{desc|json}\n" -r0
4833 "non-ascii branch: \u00e9"
4834
4835 json filter should take input as utf-8 if it was converted from utf-8:
4836
4837 $ HGENCODING=latin-1 hg log -T "{branch|json}\n" -r0
4838 "\u00e9"
4839 $ HGENCODING=latin-1 hg log -T "{desc|json}\n" -r0
4840 "non-ascii branch: \u00e9"
4841
4842 json filter takes input as utf-8b:
4843
4844 $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1
4845 "\u00e9"
4846 $ HGENCODING=ascii hg log -T "{'`cat latin1`'|json}\n" -l1
4847 "\udce9"
4848
4849 utf8 filter:
4850
4851 $ HGENCODING=ascii hg log -T "round-trip: {branch|utf8|hex}\n" -r0
4852 round-trip: c3a9
4853 $ HGENCODING=latin1 hg log -T "decoded: {'`cat latin1`'|utf8|hex}\n" -l1
4854 decoded: c3a9
4855 $ HGENCODING=ascii hg log -T "replaced: {'`cat latin1`'|utf8|hex}\n" -l1
4856 abort: decoding near * (glob)
4857 [255]
4858 $ hg log -T "coerced to string: {rev|utf8}\n" -r0
4859 coerced to string: 0
4860
4861 pad width:
4862
4863 $ HGENCODING=utf-8 hg debugtemplate "{pad('`cat utf-8`', 2, '-')}\n"
4864 \xc3\xa9- (esc)
4865
4866 $ cd ..
4867
4868 Test that template function in extension is registered as expected
4869
4870 $ cd a
4871
4872 $ cat <<EOF > $TESTTMP/customfunc.py
4873 > from mercurial import registrar
4874 >
4875 > templatefunc = registrar.templatefunc()
4876 >
4877 > @templatefunc(b'custom()')
4878 > def custom(context, mapping, args):
4879 > return b'custom'
4880 > EOF
4881 $ cat <<EOF > .hg/hgrc
4882 > [extensions]
4883 > customfunc = $TESTTMP/customfunc.py
4884 > EOF
4885
4886 $ hg log -r . -T "{custom()}\n" --config customfunc.enabled=true
4887 custom
4888
4889 $ cd ..
4890
4891 Test 'graphwidth' in 'hg log' on various topologies. The key here is that the
4892 printed graphwidths 3, 5, 7, etc. should all line up in their respective
4893 columns. We don't care about other aspects of the graph rendering here.
4894
4895 $ hg init graphwidth
4896 $ cd graphwidth
4897
4898 $ wrappabletext="a a a a a a a a a a a a"
4899
4900 $ printf "first\n" > file
4901 $ hg add file
4902 $ hg commit -m "$wrappabletext"
4903
4904 $ printf "first\nsecond\n" > file
4905 $ hg commit -m "$wrappabletext"
4906
4907 $ hg checkout 0
4908 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4909 $ printf "third\nfirst\n" > file
4910 $ hg commit -m "$wrappabletext"
4911 created new head
4912
4913 $ hg merge
4914 merging file
4915 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
4916 (branch merge, don't forget to commit)
4917
4918 $ hg log --graph -T "{graphwidth}"
4919 @ 3
4920 |
4921 | @ 5
4922 |/
4923 o 3
4924
4925 $ hg commit -m "$wrappabletext"
4926
4927 $ hg log --graph -T "{graphwidth}"
4928 @ 5
4929 |\
4930 | o 5
4931 | |
4932 o | 5
4933 |/
4934 o 3
4935
4936
4937 $ hg checkout 0
4938 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4939 $ printf "third\nfirst\nsecond\n" > file
4940 $ hg commit -m "$wrappabletext"
4941 created new head
4942
4943 $ hg log --graph -T "{graphwidth}"
4944 @ 3
4945 |
4946 | o 7
4947 | |\
4948 +---o 7
4949 | |
4950 | o 5
4951 |/
4952 o 3
4953
4954
4955 $ hg log --graph -T "{graphwidth}" -r 3
4956 o 5
4957 |\
4958 ~ ~
4959
4960 $ hg log --graph -T "{graphwidth}" -r 1
4961 o 3
4962 |
4963 ~
4964
4965 $ hg merge
4966 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4967 (branch merge, don't forget to commit)
4968 $ hg commit -m "$wrappabletext"
4969
4970 $ printf "seventh\n" >> file
4971 $ hg commit -m "$wrappabletext"
4972
4973 $ hg log --graph -T "{graphwidth}"
4974 @ 3
4975 |
4976 o 5
4977 |\
4978 | o 5
4979 | |
4980 o | 7
4981 |\ \
4982 | o | 7
4983 | |/
4984 o / 5
4985 |/
4986 o 3
4987
4988
4989 The point of graphwidth is to allow wrapping that accounts for the space taken
4990 by the graph.
4991
4992 $ COLUMNS=10 hg log --graph -T "{fill(desc, termwidth - graphwidth)}"
4993 @ a a a a
4994 | a a a a
4995 | a a a a
4996 o a a a
4997 |\ a a a
4998 | | a a a
4999 | | a a a
5000 | o a a a
5001 | | a a a
5002 | | a a a
5003 | | a a a
5004 o | a a
5005 |\ \ a a
5006 | | | a a
5007 | | | a a
5008 | | | a a
5009 | | | a a
5010 | o | a a
5011 | |/ a a
5012 | | a a
5013 | | a a
5014 | | a a
5015 | | a a
5016 o | a a a
5017 |/ a a a
5018 | a a a
5019 | a a a
5020 o a a a a
5021 a a a a
5022 a a a a
5023
5024 Something tricky happens when there are elided nodes; the next drawn row of
5025 edges can be more than one column wider, but the graph width only increases by
5026 one column. The remaining columns are added in between the nodes.
5027
5028 $ hg log --graph -T "{graphwidth}" -r "0|2|4|5"
5029 o 5
5030 |\
5031 | \
5032 | :\
5033 o : : 7
5034 :/ /
5035 : o 5
5036 :/
5037 o 3
5038
5039
5040 $ cd ..
5041
General Comments 0
You need to be logged in to leave comments. Login now