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