##// END OF EJS Templates
logcmdutil: rewrite jsonchangeset printer to be backed by jsonformatter...
Yuya Nishihara -
r38026:814151cd default
parent child Browse files
Show More
@@ -12,13 +12,11 b' import os'
12 12
13 13 from .i18n import _
14 14 from .node import (
15 hex,
16 15 nullid,
17 16 )
18 17
19 18 from . import (
20 19 dagop,
21 encoding,
22 20 error,
23 21 formatter,
24 22 graphmod,
@@ -317,78 +315,56 b' class jsonchangeset(changesetprinter):'
317 315
318 316 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False):
319 317 changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
320 self._first = True
318 self._fm = formatter.jsonformatter(ui, ui, 'log', {})
321 319
322 320 def close(self):
323 if not self._first:
324 self.ui.write("\n]\n")
325 else:
326 self.ui.write("[]\n")
321 self._fm.end()
327 322
328 323 def _show(self, ctx, copies, props):
329 324 '''show a single changeset or file revision'''
325 fm = self._fm
326 fm.startitem()
327
328 # TODO: maybe this should be wdirrev/wdirnode?
330 329 rev = ctx.rev()
331 330 if rev is None:
332 jrev = jnode = 'null'
331 hexnode = None
333 332 else:
334 jrev = '%d' % rev
335 jnode = '"%s"' % hex(ctx.node())
336 j = encoding.jsonescape
337
338 if self._first:
339 self.ui.write("[\n {")
340 self._first = False
341 else:
342 self.ui.write(",\n {")
333 hexnode = fm.hexfunc(ctx.node())
334 fm.data(rev=rev,
335 node=hexnode)
343 336
344 337 if self.ui.quiet:
345 self.ui.write(('\n "rev": %s') % jrev)
346 self.ui.write((',\n "node": %s') % jnode)
347 self.ui.write('\n }')
348 338 return
349 339
350 self.ui.write(('\n "rev": %s') % jrev)
351 self.ui.write((',\n "node": %s') % jnode)
352 self.ui.write((',\n "branch": "%s"') % j(ctx.branch()))
353 self.ui.write((',\n "phase": "%s"') % ctx.phasestr())
354 self.ui.write((',\n "user": "%s"') % j(ctx.user()))
355 self.ui.write((',\n "date": [%d, %d]') % ctx.date())
356 self.ui.write((',\n "desc": "%s"') % j(ctx.description()))
357
358 self.ui.write((',\n "bookmarks": [%s]') %
359 ", ".join('"%s"' % j(b) for b in ctx.bookmarks()))
360 self.ui.write((',\n "tags": [%s]') %
361 ", ".join('"%s"' % j(t) for t in ctx.tags()))
362 self.ui.write((',\n "parents": [%s]') %
363 ", ".join('"%s"' % c.hex() for c in ctx.parents()))
340 fm.data(branch=ctx.branch(),
341 phase=ctx.phasestr(),
342 user=ctx.user(),
343 date=fm.formatdate(ctx.date()),
344 desc=ctx.description(),
345 bookmarks=fm.formatlist(ctx.bookmarks(), name='bookmark'),
346 tags=fm.formatlist(ctx.tags(), name='tag'),
347 parents=fm.formatlist([fm.hexfunc(c.node())
348 for c in ctx.parents()], name='node'))
364 349
365 350 if self.ui.debugflag:
366 351 if rev is None:
367 jmanifestnode = 'null'
352 hexnode = None
368 353 else:
369 jmanifestnode = '"%s"' % hex(ctx.manifestnode())
370 self.ui.write((',\n "manifest": %s') % jmanifestnode)
371
372 self.ui.write((',\n "extra": {%s}') %
373 ", ".join('"%s": "%s"' % (j(k), j(v))
374 for k, v in ctx.extra().items()))
354 hexnode = fm.hexfunc(ctx.manifestnode())
355 fm.data(manifest=hexnode,
356 extra=fm.formatdict(ctx.extra()))
375 357
376 358 files = ctx.p1().status(ctx)
377 self.ui.write((',\n "modified": [%s]') %
378 ", ".join('"%s"' % j(f) for f in files[0]))
379 self.ui.write((',\n "added": [%s]') %
380 ", ".join('"%s"' % j(f) for f in files[1]))
381 self.ui.write((',\n "removed": [%s]') %
382 ", ".join('"%s"' % j(f) for f in files[2]))
359 fm.data(modified=fm.formatlist(files[0], name='file'),
360 added=fm.formatlist(files[1], name='file'),
361 removed=fm.formatlist(files[2], name='file'))
383 362
384 363 elif self.ui.verbose:
385 self.ui.write((',\n "files": [%s]') %
386 ", ".join('"%s"' % j(f) for f in ctx.files()))
387
364 fm.data(files=fm.formatlist(ctx.files(), name='file'))
388 365 if copies:
389 self.ui.write((',\n "copies": {%s}') %
390 ", ".join('"%s": "%s"' % (j(k), j(v))
391 for k, v in copies))
366 fm.data(copies=fm.formatdict(copies,
367 key='name', value='source'))
392 368
393 369 stat = self.diffopts.get('stat')
394 370 diff = self.diffopts.get('patch')
@@ -396,14 +372,11 b' class jsonchangeset(changesetprinter):'
396 372 if stat:
397 373 self.ui.pushbuffer()
398 374 self._differ.showdiff(self.ui, ctx, diffopts, stat=True)
399 self.ui.write((',\n "diffstat": "%s"')
400 % j(self.ui.popbuffer()))
375 fm.data(diffstat=self.ui.popbuffer())
401 376 if diff:
402 377 self.ui.pushbuffer()
403 378 self._differ.showdiff(self.ui, ctx, diffopts, stat=False)
404 self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer()))
405
406 self.ui.write("\n }")
379 fm.data(diff=self.ui.popbuffer())
407 380
408 381 class changesettemplater(changesetprinter):
409 382 '''format changeset information.
@@ -853,32 +853,33 b' Test xml styles:'
853 853 Test JSON style:
854 854
855 855 $ hg log -k nosuch -Tjson
856 []
856 [
857 ]
857 858
858 859 $ hg log -qr . -Tjson
859 860 [
860 861 {
861 "rev": 8,
862 "node": "95c24699272ef57d062b8bccc32c878bf841784a"
862 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
863 "rev": 8
863 864 }
864 865 ]
865 866
866 867 $ hg log -vpr . -Tjson --stat
867 868 [
868 869 {
869 "rev": 8,
870 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
870 "bookmarks": [],
871 871 "branch": "default",
872 "phase": "draft",
873 "user": "test",
874 872 "date": [1577872860, 0],
875 873 "desc": "third",
876 "bookmarks": [],
877 "tags": ["tip"],
874 "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",
875 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
876 "files": ["fourth", "second", "third"],
877 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
878 878 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
879 "files": ["fourth", "second", "third"],
880 "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n",
881 "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"
879 "phase": "draft",
880 "rev": 8,
881 "tags": ["tip"],
882 "user": "test"
882 883 }
883 884 ]
884 885
@@ -886,330 +887,330 b' honor --git but not format-breaking diff'
886 887 $ hg --config diff.noprefix=True log --git -vpr . -Tjson
887 888 [
888 889 {
889 "rev": 8,
890 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
890 "bookmarks": [],
891 891 "branch": "default",
892 "phase": "draft",
893 "user": "test",
894 892 "date": [1577872860, 0],
895 893 "desc": "third",
896 "bookmarks": [],
897 "tags": ["tip"],
894 "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",
895 "files": ["fourth", "second", "third"],
896 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
898 897 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
899 "files": ["fourth", "second", "third"],
900 "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"
898 "phase": "draft",
899 "rev": 8,
900 "tags": ["tip"],
901 "user": "test"
901 902 }
902 903 ]
903 904
904 905 $ hg log -T json
905 906 [
906 907 {
907 "rev": 8,
908 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
908 "bookmarks": [],
909 909 "branch": "default",
910 "phase": "draft",
911 "user": "test",
912 910 "date": [1577872860, 0],
913 911 "desc": "third",
914 "bookmarks": [],
912 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
913 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
914 "phase": "draft",
915 "rev": 8,
915 916 "tags": ["tip"],
916 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"]
917 "user": "test"
917 918 },
918 919 {
919 "rev": 7,
920 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
920 "bookmarks": [],
921 921 "branch": "default",
922 "phase": "draft",
923 "user": "User Name <user@hostname>",
924 922 "date": [1000000, 0],
925 923 "desc": "second",
926 "bookmarks": [],
924 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
925 "parents": ["0000000000000000000000000000000000000000"],
926 "phase": "draft",
927 "rev": 7,
927 928 "tags": [],
928 "parents": ["0000000000000000000000000000000000000000"]
929 "user": "User Name <user@hostname>"
929 930 },
930 931 {
931 "rev": 6,
932 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
932 "bookmarks": [],
933 933 "branch": "default",
934 "phase": "draft",
935 "user": "person",
936 934 "date": [1500001, 0],
937 935 "desc": "merge",
938 "bookmarks": [],
936 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
937 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
938 "phase": "draft",
939 "rev": 6,
939 940 "tags": [],
940 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"]
941 "user": "person"
941 942 },
942 943 {
943 "rev": 5,
944 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
944 "bookmarks": [],
945 945 "branch": "default",
946 "phase": "draft",
947 "user": "person",
948 946 "date": [1500000, 0],
949 947 "desc": "new head",
950 "bookmarks": [],
948 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
949 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
950 "phase": "draft",
951 "rev": 5,
951 952 "tags": [],
952 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
953 "user": "person"
953 954 },
954 955 {
955 "rev": 4,
956 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
956 "bookmarks": [],
957 957 "branch": "foo",
958 "phase": "draft",
959 "user": "person",
960 958 "date": [1400000, 0],
961 959 "desc": "new branch",
962 "bookmarks": [],
960 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
961 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
962 "phase": "draft",
963 "rev": 4,
963 964 "tags": [],
964 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"]
965 "user": "person"
965 966 },
966 967 {
967 "rev": 3,
968 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
968 "bookmarks": [],
969 969 "branch": "default",
970 "phase": "draft",
971 "user": "person",
972 970 "date": [1300000, 0],
973 971 "desc": "no user, no domain",
974 "bookmarks": [],
972 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
973 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
974 "phase": "draft",
975 "rev": 3,
975 976 "tags": [],
976 "parents": ["97054abb4ab824450e9164180baf491ae0078465"]
977 "user": "person"
977 978 },
978 979 {
979 "rev": 2,
980 "node": "97054abb4ab824450e9164180baf491ae0078465",
980 "bookmarks": [],
981 981 "branch": "default",
982 "phase": "draft",
983 "user": "other@place",
984 982 "date": [1200000, 0],
985 983 "desc": "no person",
986 "bookmarks": [],
984 "node": "97054abb4ab824450e9164180baf491ae0078465",
985 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
986 "phase": "draft",
987 "rev": 2,
987 988 "tags": [],
988 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"]
989 "user": "other@place"
989 990 },
990 991 {
991 "rev": 1,
992 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
992 "bookmarks": [],
993 993 "branch": "default",
994 "phase": "draft",
995 "user": "A. N. Other <other@place>",
996 994 "date": [1100000, 0],
997 995 "desc": "other 1\nother 2\n\nother 3",
998 "bookmarks": [],
996 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
997 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
998 "phase": "draft",
999 "rev": 1,
999 1000 "tags": [],
1000 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"]
1001 "user": "A. N. Other <other@place>"
1001 1002 },
1002 1003 {
1003 "rev": 0,
1004 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1004 "bookmarks": [],
1005 1005 "branch": "default",
1006 "phase": "draft",
1007 "user": "User Name <user@hostname>",
1008 1006 "date": [1000000, 0],
1009 1007 "desc": "line 1\nline 2",
1010 "bookmarks": [],
1008 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1009 "parents": ["0000000000000000000000000000000000000000"],
1010 "phase": "draft",
1011 "rev": 0,
1011 1012 "tags": [],
1012 "parents": ["0000000000000000000000000000000000000000"]
1013 "user": "User Name <user@hostname>"
1013 1014 }
1014 1015 ]
1015 1016
1016 1017 $ hg heads -v -Tjson
1017 1018 [
1018 1019 {
1019 "rev": 8,
1020 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1020 "bookmarks": [],
1021 1021 "branch": "default",
1022 "phase": "draft",
1023 "user": "test",
1024 1022 "date": [1577872860, 0],
1025 1023 "desc": "third",
1026 "bookmarks": [],
1024 "files": ["fourth", "second", "third"],
1025 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1026 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1027 "phase": "draft",
1028 "rev": 8,
1027 1029 "tags": ["tip"],
1028 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1029 "files": ["fourth", "second", "third"]
1030 "user": "test"
1030 1031 },
1031 1032 {
1032 "rev": 6,
1033 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1033 "bookmarks": [],
1034 1034 "branch": "default",
1035 "phase": "draft",
1036 "user": "person",
1037 1035 "date": [1500001, 0],
1038 1036 "desc": "merge",
1039 "bookmarks": [],
1037 "files": [],
1038 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1039 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1040 "phase": "draft",
1041 "rev": 6,
1040 1042 "tags": [],
1041 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1042 "files": []
1043 "user": "person"
1043 1044 },
1044 1045 {
1045 "rev": 4,
1046 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1046 "bookmarks": [],
1047 1047 "branch": "foo",
1048 "phase": "draft",
1049 "user": "person",
1050 1048 "date": [1400000, 0],
1051 1049 "desc": "new branch",
1052 "bookmarks": [],
1050 "files": [],
1051 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1052 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1053 "phase": "draft",
1054 "rev": 4,
1053 1055 "tags": [],
1054 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1055 "files": []
1056 "user": "person"
1056 1057 }
1057 1058 ]
1058 1059
1059 1060 $ hg log --debug -Tjson
1060 1061 [
1061 1062 {
1062 "rev": 8,
1063 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1063 "added": ["fourth", "third"],
1064 "bookmarks": [],
1064 1065 "branch": "default",
1065 "phase": "draft",
1066 "user": "test",
1067 1066 "date": [1577872860, 0],
1068 1067 "desc": "third",
1069 "bookmarks": [],
1070 "tags": ["tip"],
1071 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1068 "extra": {"branch": "default"},
1072 1069 "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64",
1073 "extra": {"branch": "default"},
1074 1070 "modified": [],
1075 "added": ["fourth", "third"],
1076 "removed": ["second"]
1071 "node": "95c24699272ef57d062b8bccc32c878bf841784a",
1072 "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"],
1073 "phase": "draft",
1074 "removed": ["second"],
1075 "rev": 8,
1076 "tags": ["tip"],
1077 "user": "test"
1077 1078 },
1078 1079 {
1079 "rev": 7,
1080 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
1080 "added": ["second"],
1081 "bookmarks": [],
1081 1082 "branch": "default",
1082 "phase": "draft",
1083 "user": "User Name <user@hostname>",
1084 1083 "date": [1000000, 0],
1085 1084 "desc": "second",
1086 "bookmarks": [],
1087 "tags": [],
1088 "parents": ["0000000000000000000000000000000000000000"],
1085 "extra": {"branch": "default"},
1089 1086 "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf",
1090 "extra": {"branch": "default"},
1091 1087 "modified": [],
1092 "added": ["second"],
1093 "removed": []
1088 "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453",
1089 "parents": ["0000000000000000000000000000000000000000"],
1090 "phase": "draft",
1091 "removed": [],
1092 "rev": 7,
1093 "tags": [],
1094 "user": "User Name <user@hostname>"
1094 1095 },
1095 1096 {
1096 "rev": 6,
1097 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1097 "added": [],
1098 "bookmarks": [],
1098 1099 "branch": "default",
1099 "phase": "draft",
1100 "user": "person",
1101 1100 "date": [1500001, 0],
1102 1101 "desc": "merge",
1103 "bookmarks": [],
1104 "tags": [],
1105 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1102 "extra": {"branch": "default"},
1106 1103 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1107 "extra": {"branch": "default"},
1108 1104 "modified": [],
1109 "added": [],
1110 "removed": []
1105 "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b",
1106 "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"],
1107 "phase": "draft",
1108 "removed": [],
1109 "rev": 6,
1110 "tags": [],
1111 "user": "person"
1111 1112 },
1112 1113 {
1113 "rev": 5,
1114 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
1114 "added": ["d"],
1115 "bookmarks": [],
1115 1116 "branch": "default",
1116 "phase": "draft",
1117 "user": "person",
1118 1117 "date": [1500000, 0],
1119 1118 "desc": "new head",
1120 "bookmarks": [],
1121 "tags": [],
1122 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1119 "extra": {"branch": "default"},
1123 1120 "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216",
1124 "extra": {"branch": "default"},
1125 1121 "modified": [],
1126 "added": ["d"],
1127 "removed": []
1122 "node": "13207e5a10d9fd28ec424934298e176197f2c67f",
1123 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1124 "phase": "draft",
1125 "removed": [],
1126 "rev": 5,
1127 "tags": [],
1128 "user": "person"
1128 1129 },
1129 1130 {
1130 "rev": 4,
1131 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1131 "added": [],
1132 "bookmarks": [],
1132 1133 "branch": "foo",
1133 "phase": "draft",
1134 "user": "person",
1135 1134 "date": [1400000, 0],
1136 1135 "desc": "new branch",
1137 "bookmarks": [],
1138 "tags": [],
1139 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1136 "extra": {"branch": "foo"},
1140 1137 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1141 "extra": {"branch": "foo"},
1142 1138 "modified": [],
1143 "added": [],
1144 "removed": []
1139 "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74",
1140 "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"],
1141 "phase": "draft",
1142 "removed": [],
1143 "rev": 4,
1144 "tags": [],
1145 "user": "person"
1145 1146 },
1146 1147 {
1147 "rev": 3,
1148 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
1148 "added": [],
1149 "bookmarks": [],
1149 1150 "branch": "default",
1150 "phase": "draft",
1151 "user": "person",
1152 1151 "date": [1300000, 0],
1153 1152 "desc": "no user, no domain",
1154 "bookmarks": [],
1155 "tags": [],
1156 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
1153 "extra": {"branch": "default"},
1157 1154 "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc",
1158 "extra": {"branch": "default"},
1159 1155 "modified": ["c"],
1160 "added": [],
1161 "removed": []
1156 "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47",
1157 "parents": ["97054abb4ab824450e9164180baf491ae0078465"],
1158 "phase": "draft",
1159 "removed": [],
1160 "rev": 3,
1161 "tags": [],
1162 "user": "person"
1162 1163 },
1163 1164 {
1164 "rev": 2,
1165 "node": "97054abb4ab824450e9164180baf491ae0078465",
1165 "added": ["c"],
1166 "bookmarks": [],
1166 1167 "branch": "default",
1167 "phase": "draft",
1168 "user": "other@place",
1169 1168 "date": [1200000, 0],
1170 1169 "desc": "no person",
1171 "bookmarks": [],
1172 "tags": [],
1173 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1170 "extra": {"branch": "default"},
1174 1171 "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1",
1175 "extra": {"branch": "default"},
1176 1172 "modified": [],
1177 "added": ["c"],
1178 "removed": []
1173 "node": "97054abb4ab824450e9164180baf491ae0078465",
1174 "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"],
1175 "phase": "draft",
1176 "removed": [],
1177 "rev": 2,
1178 "tags": [],
1179 "user": "other@place"
1179 1180 },
1180 1181 {
1181 "rev": 1,
1182 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1182 "added": ["b"],
1183 "bookmarks": [],
1183 1184 "branch": "default",
1184 "phase": "draft",
1185 "user": "A. N. Other <other@place>",
1186 1185 "date": [1100000, 0],
1187 1186 "desc": "other 1\nother 2\n\nother 3",
1188 "bookmarks": [],
1189 "tags": [],
1190 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1187 "extra": {"branch": "default"},
1191 1188 "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55",
1192 "extra": {"branch": "default"},
1193 1189 "modified": [],
1194 "added": ["b"],
1195 "removed": []
1190 "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965",
1191 "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"],
1192 "phase": "draft",
1193 "removed": [],
1194 "rev": 1,
1195 "tags": [],
1196 "user": "A. N. Other <other@place>"
1196 1197 },
1197 1198 {
1198 "rev": 0,
1199 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1199 "added": ["a"],
1200 "bookmarks": [],
1200 1201 "branch": "default",
1201 "phase": "draft",
1202 "user": "User Name <user@hostname>",
1203 1202 "date": [1000000, 0],
1204 1203 "desc": "line 1\nline 2",
1205 "bookmarks": [],
1206 "tags": [],
1207 "parents": ["0000000000000000000000000000000000000000"],
1204 "extra": {"branch": "default"},
1208 1205 "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0",
1209 "extra": {"branch": "default"},
1210 1206 "modified": [],
1211 "added": ["a"],
1212 "removed": []
1207 "node": "1e4e1b8f71e05681d422154f5421e385fec3454f",
1208 "parents": ["0000000000000000000000000000000000000000"],
1209 "phase": "draft",
1210 "removed": [],
1211 "rev": 0,
1212 "tags": [],
1213 "user": "User Name <user@hostname>"
1213 1214 }
1214 1215 ]
1215 1216
@@ -254,52 +254,52 b' With --template.'
254 254 $ hg log -f -L foo,5:7 -T json
255 255 [
256 256 {
257 "rev": 5,
258 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
257 "bookmarks": [],
259 258 "branch": "default",
260 "phase": "draft",
261 "user": "test",
262 259 "date": [0, 0],
263 260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
264 "bookmarks": [],
261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 "phase": "draft",
264 "rev": 5,
265 265 "tags": ["tip"],
266 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"]
266 "user": "test"
267 267 },
268 268 {
269 "rev": 4,
270 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
269 "bookmarks": [],
271 270 "branch": "default",
272 "phase": "draft",
273 "user": "test",
274 271 "date": [0, 0],
275 272 "desc": "11 -> 11+; leading space before \"1\"",
276 "bookmarks": [],
273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 "phase": "draft",
276 "rev": 4,
277 277 "tags": [],
278 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"]
278 "user": "test"
279 279 },
280 280 {
281 "rev": 2,
282 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
281 "bookmarks": [],
283 282 "branch": "default",
284 "phase": "draft",
285 "user": "test",
286 283 "date": [0, 0],
287 284 "desc": "2 -> 2+; added bar",
288 "bookmarks": [],
285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 "phase": "draft",
288 "rev": 2,
289 289 "tags": [],
290 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"]
290 "user": "test"
291 291 },
292 292 {
293 "rev": 0,
294 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
293 "bookmarks": [],
295 294 "branch": "default",
296 "phase": "draft",
297 "user": "test",
298 295 "date": [0, 0],
299 296 "desc": "init",
300 "bookmarks": [],
297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 "parents": ["0000000000000000000000000000000000000000"],
299 "phase": "draft",
300 "rev": 0,
301 301 "tags": [],
302 "parents": ["0000000000000000000000000000000000000000"]
302 "user": "test"
303 303 }
304 304 ]
305 305
@@ -619,18 +619,18 b' log copies with hardcoded style and with'
619 619 $ hg log -vC -r4 -Tjson
620 620 [
621 621 {
622 "rev": 4,
623 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
622 "bookmarks": [],
624 623 "branch": "default",
625 "phase": "draft",
626 "user": "test",
624 "copies": {"e": "dir/b"},
627 625 "date": [5, 0],
628 626 "desc": "e",
629 "bookmarks": [],
630 "tags": ["tip"],
627 "files": ["dir/b", "e"],
628 "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3",
631 629 "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"],
632 "files": ["dir/b", "e"],
633 "copies": {"e": "dir/b"}
630 "phase": "draft",
631 "rev": 4,
632 "tags": ["tip"],
633 "user": "test"
634 634 }
635 635 ]
636 636
@@ -2201,45 +2201,45 b' dirty:'
2201 2201 $ hg log -r 'wdir()' -Tjson
2202 2202 [
2203 2203 {
2204 "rev": null,
2205 "node": null,
2204 "bookmarks": [],
2206 2205 "branch": "default",
2207 "phase": "draft",
2208 "user": "test",
2209 2206 "date": [*, 0], (glob)
2210 2207 "desc": "",
2211 "bookmarks": [],
2208 "node": null,
2209 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2210 "phase": "draft",
2211 "rev": null,
2212 2212 "tags": [],
2213 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"]
2213 "user": "test"
2214 2214 }
2215 2215 ]
2216 2216
2217 2217 $ hg log -r 'wdir()' -Tjson -q
2218 2218 [
2219 2219 {
2220 "rev": null,
2221 "node": null
2220 "node": null,
2221 "rev": null
2222 2222 }
2223 2223 ]
2224 2224
2225 2225 $ hg log -r 'wdir()' -Tjson --debug
2226 2226 [
2227 2227 {
2228 "rev": null,
2229 "node": null,
2228 "added": ["d1/f2"],
2229 "bookmarks": [],
2230 2230 "branch": "default",
2231 "phase": "draft",
2232 "user": "test",
2233 2231 "date": [*, 0], (glob)
2234 2232 "desc": "",
2235 "bookmarks": [],
2236 "tags": [],
2237 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2233 "extra": {"branch": "default"},
2238 2234 "manifest": null,
2239 "extra": {"branch": "default"},
2240 2235 "modified": ["d1/f1"],
2241 "added": ["d1/f2"],
2242 "removed": [".d6/f1"]
2236 "node": null,
2237 "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"],
2238 "phase": "draft",
2239 "removed": [".d6/f1"],
2240 "rev": null,
2241 "tags": [],
2242 "user": "test"
2243 2243 }
2244 2244 ]
2245 2245
General Comments 0
You need to be logged in to leave comments. Login now