diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -12,13 +12,11 @@ import os from .i18n import _ from .node import ( - hex, nullid, ) from . import ( dagop, - encoding, error, formatter, graphmod, @@ -317,78 +315,56 @@ class jsonchangeset(changesetprinter): def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False): changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered) - self._first = True + self._fm = formatter.jsonformatter(ui, ui, 'log', {}) def close(self): - if not self._first: - self.ui.write("\n]\n") - else: - self.ui.write("[]\n") + self._fm.end() def _show(self, ctx, copies, props): '''show a single changeset or file revision''' + fm = self._fm + fm.startitem() + + # TODO: maybe this should be wdirrev/wdirnode? rev = ctx.rev() if rev is None: - jrev = jnode = 'null' + hexnode = None else: - jrev = '%d' % rev - jnode = '"%s"' % hex(ctx.node()) - j = encoding.jsonescape - - if self._first: - self.ui.write("[\n {") - self._first = False - else: - self.ui.write(",\n {") + hexnode = fm.hexfunc(ctx.node()) + fm.data(rev=rev, + node=hexnode) if self.ui.quiet: - self.ui.write(('\n "rev": %s') % jrev) - self.ui.write((',\n "node": %s') % jnode) - self.ui.write('\n }') return - self.ui.write(('\n "rev": %s') % jrev) - self.ui.write((',\n "node": %s') % jnode) - self.ui.write((',\n "branch": "%s"') % j(ctx.branch())) - self.ui.write((',\n "phase": "%s"') % ctx.phasestr()) - self.ui.write((',\n "user": "%s"') % j(ctx.user())) - self.ui.write((',\n "date": [%d, %d]') % ctx.date()) - self.ui.write((',\n "desc": "%s"') % j(ctx.description())) - - self.ui.write((',\n "bookmarks": [%s]') % - ", ".join('"%s"' % j(b) for b in ctx.bookmarks())) - self.ui.write((',\n "tags": [%s]') % - ", ".join('"%s"' % j(t) for t in ctx.tags())) - self.ui.write((',\n "parents": [%s]') % - ", ".join('"%s"' % c.hex() for c in ctx.parents())) + fm.data(branch=ctx.branch(), + phase=ctx.phasestr(), + user=ctx.user(), + date=fm.formatdate(ctx.date()), + desc=ctx.description(), + bookmarks=fm.formatlist(ctx.bookmarks(), name='bookmark'), + tags=fm.formatlist(ctx.tags(), name='tag'), + parents=fm.formatlist([fm.hexfunc(c.node()) + for c in ctx.parents()], name='node')) if self.ui.debugflag: if rev is None: - jmanifestnode = 'null' + hexnode = None else: - jmanifestnode = '"%s"' % hex(ctx.manifestnode()) - self.ui.write((',\n "manifest": %s') % jmanifestnode) - - self.ui.write((',\n "extra": {%s}') % - ", ".join('"%s": "%s"' % (j(k), j(v)) - for k, v in ctx.extra().items())) + hexnode = fm.hexfunc(ctx.manifestnode()) + fm.data(manifest=hexnode, + extra=fm.formatdict(ctx.extra())) files = ctx.p1().status(ctx) - self.ui.write((',\n "modified": [%s]') % - ", ".join('"%s"' % j(f) for f in files[0])) - self.ui.write((',\n "added": [%s]') % - ", ".join('"%s"' % j(f) for f in files[1])) - self.ui.write((',\n "removed": [%s]') % - ", ".join('"%s"' % j(f) for f in files[2])) + fm.data(modified=fm.formatlist(files[0], name='file'), + added=fm.formatlist(files[1], name='file'), + removed=fm.formatlist(files[2], name='file')) elif self.ui.verbose: - self.ui.write((',\n "files": [%s]') % - ", ".join('"%s"' % j(f) for f in ctx.files())) - + fm.data(files=fm.formatlist(ctx.files(), name='file')) if copies: - self.ui.write((',\n "copies": {%s}') % - ", ".join('"%s": "%s"' % (j(k), j(v)) - for k, v in copies)) + fm.data(copies=fm.formatdict(copies, + key='name', value='source')) stat = self.diffopts.get('stat') diff = self.diffopts.get('patch') @@ -396,14 +372,11 @@ class jsonchangeset(changesetprinter): if stat: self.ui.pushbuffer() self._differ.showdiff(self.ui, ctx, diffopts, stat=True) - self.ui.write((',\n "diffstat": "%s"') - % j(self.ui.popbuffer())) + fm.data(diffstat=self.ui.popbuffer()) if diff: self.ui.pushbuffer() self._differ.showdiff(self.ui, ctx, diffopts, stat=False) - self.ui.write((',\n "diff": "%s"') % j(self.ui.popbuffer())) - - self.ui.write("\n }") + fm.data(diff=self.ui.popbuffer()) class changesettemplater(changesetprinter): '''format changeset information. diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -853,32 +853,33 @@ Test xml styles: Test JSON style: $ hg log -k nosuch -Tjson - [] + [ + ] $ hg log -qr . -Tjson [ { - "rev": 8, - "node": "95c24699272ef57d062b8bccc32c878bf841784a" + "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "rev": 8 } ] $ hg log -vpr . -Tjson --stat [ { - "rev": 8, - "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [1577872860, 0], "desc": "third", - "bookmarks": [], - "tags": ["tip"], + "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", + "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n", + "files": ["fourth", "second", "third"], + "node": "95c24699272ef57d062b8bccc32c878bf841784a", "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], - "files": ["fourth", "second", "third"], - "diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n", - "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" + "phase": "draft", + "rev": 8, + "tags": ["tip"], + "user": "test" } ] @@ -886,330 +887,330 @@ honor --git but not format-breaking diff $ hg --config diff.noprefix=True log --git -vpr . -Tjson [ { - "rev": 8, - "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [1577872860, 0], "desc": "third", - "bookmarks": [], - "tags": ["tip"], + "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", + "files": ["fourth", "second", "third"], + "node": "95c24699272ef57d062b8bccc32c878bf841784a", "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], - "files": ["fourth", "second", "third"], - "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" + "phase": "draft", + "rev": 8, + "tags": ["tip"], + "user": "test" } ] $ hg log -T json [ { - "rev": 8, - "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [1577872860, 0], "desc": "third", - "bookmarks": [], + "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], + "phase": "draft", + "rev": 8, "tags": ["tip"], - "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"] + "user": "test" }, { - "rev": 7, - "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "User Name ", "date": [1000000, 0], "desc": "second", - "bookmarks": [], + "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453", + "parents": ["0000000000000000000000000000000000000000"], + "phase": "draft", + "rev": 7, "tags": [], - "parents": ["0000000000000000000000000000000000000000"] + "user": "User Name " }, { - "rev": 6, - "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1500001, 0], "desc": "merge", - "bookmarks": [], + "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b", + "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"], + "phase": "draft", + "rev": 6, "tags": [], - "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"] + "user": "person" }, { - "rev": 5, - "node": "13207e5a10d9fd28ec424934298e176197f2c67f", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1500000, 0], "desc": "new head", - "bookmarks": [], + "node": "13207e5a10d9fd28ec424934298e176197f2c67f", + "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "phase": "draft", + "rev": 5, "tags": [], - "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"] + "user": "person" }, { - "rev": 4, - "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74", + "bookmarks": [], "branch": "foo", - "phase": "draft", - "user": "person", "date": [1400000, 0], "desc": "new branch", - "bookmarks": [], + "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74", + "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "phase": "draft", + "rev": 4, "tags": [], - "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"] + "user": "person" }, { - "rev": 3, - "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1300000, 0], "desc": "no user, no domain", - "bookmarks": [], + "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47", + "parents": ["97054abb4ab824450e9164180baf491ae0078465"], + "phase": "draft", + "rev": 3, "tags": [], - "parents": ["97054abb4ab824450e9164180baf491ae0078465"] + "user": "person" }, { - "rev": 2, - "node": "97054abb4ab824450e9164180baf491ae0078465", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "other@place", "date": [1200000, 0], "desc": "no person", - "bookmarks": [], + "node": "97054abb4ab824450e9164180baf491ae0078465", + "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"], + "phase": "draft", + "rev": 2, "tags": [], - "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"] + "user": "other@place" }, { - "rev": 1, - "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "A. N. Other ", "date": [1100000, 0], "desc": "other 1\nother 2\n\nother 3", - "bookmarks": [], + "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965", + "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"], + "phase": "draft", + "rev": 1, "tags": [], - "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"] + "user": "A. N. Other " }, { - "rev": 0, - "node": "1e4e1b8f71e05681d422154f5421e385fec3454f", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "User Name ", "date": [1000000, 0], "desc": "line 1\nline 2", - "bookmarks": [], + "node": "1e4e1b8f71e05681d422154f5421e385fec3454f", + "parents": ["0000000000000000000000000000000000000000"], + "phase": "draft", + "rev": 0, "tags": [], - "parents": ["0000000000000000000000000000000000000000"] + "user": "User Name " } ] $ hg heads -v -Tjson [ { - "rev": 8, - "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [1577872860, 0], "desc": "third", - "bookmarks": [], + "files": ["fourth", "second", "third"], + "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], + "phase": "draft", + "rev": 8, "tags": ["tip"], - "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], - "files": ["fourth", "second", "third"] + "user": "test" }, { - "rev": 6, - "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1500001, 0], "desc": "merge", - "bookmarks": [], + "files": [], + "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b", + "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"], + "phase": "draft", + "rev": 6, "tags": [], - "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"], - "files": [] + "user": "person" }, { - "rev": 4, - "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74", + "bookmarks": [], "branch": "foo", - "phase": "draft", - "user": "person", "date": [1400000, 0], "desc": "new branch", - "bookmarks": [], + "files": [], + "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74", + "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "phase": "draft", + "rev": 4, "tags": [], - "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], - "files": [] + "user": "person" } ] $ hg log --debug -Tjson [ { - "rev": 8, - "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "added": ["fourth", "third"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [1577872860, 0], "desc": "third", - "bookmarks": [], - "tags": ["tip"], - "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], + "extra": {"branch": "default"}, "manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64", - "extra": {"branch": "default"}, "modified": [], - "added": ["fourth", "third"], - "removed": ["second"] + "node": "95c24699272ef57d062b8bccc32c878bf841784a", + "parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], + "phase": "draft", + "removed": ["second"], + "rev": 8, + "tags": ["tip"], + "user": "test" }, { - "rev": 7, - "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453", + "added": ["second"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "User Name ", "date": [1000000, 0], "desc": "second", - "bookmarks": [], - "tags": [], - "parents": ["0000000000000000000000000000000000000000"], + "extra": {"branch": "default"}, "manifest": "f2dbc354b94e5ec0b4f10680ee0cee816101d0bf", - "extra": {"branch": "default"}, "modified": [], - "added": ["second"], - "removed": [] + "node": "29114dbae42b9f078cf2714dbe3a86bba8ec7453", + "parents": ["0000000000000000000000000000000000000000"], + "phase": "draft", + "removed": [], + "rev": 7, + "tags": [], + "user": "User Name " }, { - "rev": 6, - "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b", + "added": [], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1500001, 0], "desc": "merge", - "bookmarks": [], - "tags": [], - "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"], + "extra": {"branch": "default"}, "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216", - "extra": {"branch": "default"}, "modified": [], - "added": [], - "removed": [] + "node": "d41e714fe50d9e4a5f11b4d595d543481b5f980b", + "parents": ["13207e5a10d9fd28ec424934298e176197f2c67f", "bbe44766e73d5f11ed2177f1838de10c53ef3e74"], + "phase": "draft", + "removed": [], + "rev": 6, + "tags": [], + "user": "person" }, { - "rev": 5, - "node": "13207e5a10d9fd28ec424934298e176197f2c67f", + "added": ["d"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1500000, 0], "desc": "new head", - "bookmarks": [], - "tags": [], - "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "extra": {"branch": "default"}, "manifest": "4dc3def4f9b4c6e8de820f6ee74737f91e96a216", - "extra": {"branch": "default"}, "modified": [], - "added": ["d"], - "removed": [] + "node": "13207e5a10d9fd28ec424934298e176197f2c67f", + "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "phase": "draft", + "removed": [], + "rev": 5, + "tags": [], + "user": "person" }, { - "rev": 4, - "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74", + "added": [], + "bookmarks": [], "branch": "foo", - "phase": "draft", - "user": "person", "date": [1400000, 0], "desc": "new branch", - "bookmarks": [], - "tags": [], - "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "extra": {"branch": "foo"}, "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc", - "extra": {"branch": "foo"}, "modified": [], - "added": [], - "removed": [] + "node": "bbe44766e73d5f11ed2177f1838de10c53ef3e74", + "parents": ["10e46f2dcbf4823578cf180f33ecf0b957964c47"], + "phase": "draft", + "removed": [], + "rev": 4, + "tags": [], + "user": "person" }, { - "rev": 3, - "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47", + "added": [], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "person", "date": [1300000, 0], "desc": "no user, no domain", - "bookmarks": [], - "tags": [], - "parents": ["97054abb4ab824450e9164180baf491ae0078465"], + "extra": {"branch": "default"}, "manifest": "cb5a1327723bada42f117e4c55a303246eaf9ccc", - "extra": {"branch": "default"}, "modified": ["c"], - "added": [], - "removed": [] + "node": "10e46f2dcbf4823578cf180f33ecf0b957964c47", + "parents": ["97054abb4ab824450e9164180baf491ae0078465"], + "phase": "draft", + "removed": [], + "rev": 3, + "tags": [], + "user": "person" }, { - "rev": 2, - "node": "97054abb4ab824450e9164180baf491ae0078465", + "added": ["c"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "other@place", "date": [1200000, 0], "desc": "no person", - "bookmarks": [], - "tags": [], - "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"], + "extra": {"branch": "default"}, "manifest": "6e0e82995c35d0d57a52aca8da4e56139e06b4b1", - "extra": {"branch": "default"}, "modified": [], - "added": ["c"], - "removed": [] + "node": "97054abb4ab824450e9164180baf491ae0078465", + "parents": ["b608e9d1a3f0273ccf70fb85fd6866b3482bf965"], + "phase": "draft", + "removed": [], + "rev": 2, + "tags": [], + "user": "other@place" }, { - "rev": 1, - "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965", + "added": ["b"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "A. N. Other ", "date": [1100000, 0], "desc": "other 1\nother 2\n\nother 3", - "bookmarks": [], - "tags": [], - "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"], + "extra": {"branch": "default"}, "manifest": "4e8d705b1e53e3f9375e0e60dc7b525d8211fe55", - "extra": {"branch": "default"}, "modified": [], - "added": ["b"], - "removed": [] + "node": "b608e9d1a3f0273ccf70fb85fd6866b3482bf965", + "parents": ["1e4e1b8f71e05681d422154f5421e385fec3454f"], + "phase": "draft", + "removed": [], + "rev": 1, + "tags": [], + "user": "A. N. Other " }, { - "rev": 0, - "node": "1e4e1b8f71e05681d422154f5421e385fec3454f", + "added": ["a"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "User Name ", "date": [1000000, 0], "desc": "line 1\nline 2", - "bookmarks": [], - "tags": [], - "parents": ["0000000000000000000000000000000000000000"], + "extra": {"branch": "default"}, "manifest": "a0c8bcbbb45c63b90b70ad007bf38961f64f2af0", - "extra": {"branch": "default"}, "modified": [], - "added": ["a"], - "removed": [] + "node": "1e4e1b8f71e05681d422154f5421e385fec3454f", + "parents": ["0000000000000000000000000000000000000000"], + "phase": "draft", + "removed": [], + "rev": 0, + "tags": [], + "user": "User Name " } ] diff --git a/tests/test-log-linerange.t b/tests/test-log-linerange.t --- a/tests/test-log-linerange.t +++ b/tests/test-log-linerange.t @@ -254,52 +254,52 @@ With --template. $ hg log -f -L foo,5:7 -T json [ { - "rev": 5, - "node": "cfdf972b3971a2a59638bf9583c0debbffee5404", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [0, 0], "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+", - "bookmarks": [], + "node": "cfdf972b3971a2a59638bf9583c0debbffee5404", + "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"], + "phase": "draft", + "rev": 5, "tags": ["tip"], - "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"] + "user": "test" }, { - "rev": 4, - "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [0, 0], "desc": "11 -> 11+; leading space before \"1\"", - "bookmarks": [], + "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c", + "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"], + "phase": "draft", + "rev": 4, "tags": [], - "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"] + "user": "test" }, { - "rev": 2, - "node": "63a884426fd0b277fcd55895bbb2f230434576eb", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [0, 0], "desc": "2 -> 2+; added bar", - "bookmarks": [], + "node": "63a884426fd0b277fcd55895bbb2f230434576eb", + "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"], + "phase": "draft", + "rev": 2, "tags": [], - "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"] + "user": "test" }, { - "rev": 0, - "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [0, 0], "desc": "init", - "bookmarks": [], + "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4", + "parents": ["0000000000000000000000000000000000000000"], + "phase": "draft", + "rev": 0, "tags": [], - "parents": ["0000000000000000000000000000000000000000"] + "user": "test" } ] diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -619,18 +619,18 @@ log copies with hardcoded style and with $ hg log -vC -r4 -Tjson [ { - "rev": 4, - "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3", + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", + "copies": {"e": "dir/b"}, "date": [5, 0], "desc": "e", - "bookmarks": [], - "tags": ["tip"], + "files": ["dir/b", "e"], + "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3", "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"], - "files": ["dir/b", "e"], - "copies": {"e": "dir/b"} + "phase": "draft", + "rev": 4, + "tags": ["tip"], + "user": "test" } ] @@ -2201,45 +2201,45 @@ dirty: $ hg log -r 'wdir()' -Tjson [ { - "rev": null, - "node": null, + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [*, 0], (glob) "desc": "", - "bookmarks": [], + "node": null, + "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"], + "phase": "draft", + "rev": null, "tags": [], - "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"] + "user": "test" } ] $ hg log -r 'wdir()' -Tjson -q [ { - "rev": null, - "node": null + "node": null, + "rev": null } ] $ hg log -r 'wdir()' -Tjson --debug [ { - "rev": null, - "node": null, + "added": ["d1/f2"], + "bookmarks": [], "branch": "default", - "phase": "draft", - "user": "test", "date": [*, 0], (glob) "desc": "", - "bookmarks": [], - "tags": [], - "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"], + "extra": {"branch": "default"}, "manifest": null, - "extra": {"branch": "default"}, "modified": ["d1/f1"], - "added": ["d1/f2"], - "removed": [".d6/f1"] + "node": null, + "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"], + "phase": "draft", + "removed": [".d6/f1"], + "rev": null, + "tags": [], + "user": "test" } ]