667 <extra key="branch">default</extra> |
667 <extra key="branch">default</extra> |
668 </logentry> |
668 </logentry> |
669 </log> |
669 </log> |
670 |
670 |
671 |
671 |
|
672 test CBOR style: |
|
673 |
|
674 $ cat <<'EOF' > "$TESTTMP/decodecborarray.py" |
|
675 > from __future__ import absolute_import |
|
676 > from mercurial import pycompat |
|
677 > from mercurial.utils import ( |
|
678 > cborutil, |
|
679 > stringutil, |
|
680 > ) |
|
681 > data = pycompat.stdin.read() |
|
682 > # our CBOR decoder doesn't support parsing indefinite-length arrays, |
|
683 > # but the log output is indefinite stream by nature. |
|
684 > assert data[:1] == cborutil.BEGIN_INDEFINITE_ARRAY |
|
685 > assert data[-1:] == cborutil.BREAK |
|
686 > items = cborutil.decodeall(data[1:-1]) |
|
687 > pycompat.stdout.write(stringutil.pprint(items, indent=1) + b'\n') |
|
688 > EOF |
|
689 |
|
690 $ hg log -k nosuch -Tcbor | "$PYTHON" "$TESTTMP/decodecborarray.py" |
|
691 [] |
|
692 |
|
693 $ hg log -qr0:1 -Tcbor | "$PYTHON" "$TESTTMP/decodecborarray.py" |
|
694 [ |
|
695 { |
|
696 'node': '1e4e1b8f71e05681d422154f5421e385fec3454f', |
|
697 'rev': 0 |
|
698 }, |
|
699 { |
|
700 'node': 'b608e9d1a3f0273ccf70fb85fd6866b3482bf965', |
|
701 'rev': 1 |
|
702 } |
|
703 ] |
|
704 |
|
705 $ hg log -vpr . -Tcbor --stat | "$PYTHON" "$TESTTMP/decodecborarray.py" |
|
706 [ |
|
707 { |
|
708 'bookmarks': [], |
|
709 'branch': 'default', |
|
710 'date': [ |
|
711 1577872860, |
|
712 0 |
|
713 ], |
|
714 'desc': 'third', |
|
715 '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', |
|
716 'diffstat': ' fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n', |
|
717 'files': [ |
|
718 'fourth', |
|
719 'second', |
|
720 'third' |
|
721 ], |
|
722 'node': '95c24699272ef57d062b8bccc32c878bf841784a', |
|
723 'parents': [ |
|
724 '29114dbae42b9f078cf2714dbe3a86bba8ec7453' |
|
725 ], |
|
726 'phase': 'draft', |
|
727 'rev': 8, |
|
728 'tags': [ |
|
729 'tip' |
|
730 ], |
|
731 'user': 'test' |
|
732 } |
|
733 ] |
|
734 |
|
735 |
672 Test JSON style: |
736 Test JSON style: |
673 |
737 |
674 $ hg log -k nosuch -Tjson |
738 $ hg log -k nosuch -Tjson |
675 [ |
739 [ |
676 ] |
740 ] |