[PATCH 6 of 6 json-style] tests: add tests for json output from hgweb
Matt Mackall
mpm at selenic.com
Thu Jan 1 23:26:43 UTC 2015
On Wed, 2014-12-31 at 14:45 -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1420065389 28800
> # Wed Dec 31 14:36:29 2014 -0800
> # Node ID 375310e882793f02023305f1065f616b0b42ab88
> # Parent 8a88b921f7b9b467046496ab6aa99d2589dd935c
> tests: add tests for json output from hgweb
> + {"author": "test", "branch": [], "child": [], "date": [0.0, 0],
> "desc": "move foo", "extra": {"branch": "default"}, "file": "foo-new",
> "node": "78896eb0e102174ce9278438a95e12543e4367a7", "parent":
> [{"branch": "default", "date": [0.0, 0], "description": "modify foo",
> "file": "foo", "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
> "rev": 1, "user": "test"}], "path": "/", "permissions": "", "rename":
> [{"file": "foo", "node": "cebda196bdbe7661cec847739e7c5de89ec6e5a5"}],
> "rev": 3, "text": [{"line": "bar\n", "lineid": "l1", "linenumber": "
> 1", "parity": 0}]} (no-eol)
This should be aiming to agree with the schema produced by hg log -T
json today. Eg:
$ hg log -Tjson -l1
[
{
"rev": 26053,
"node": "3314664606e63e0ae263b71f5210e8153291efe8",
"branch": "default",
"phase": "public",
"user": "Matt Mackall <mpm at selenic.com>",
"date": [1420152434, 21600],
"desc": "merge with stable",
"bookmarks": ["@"],
"tags": ["tip"],
"parents": ["28a302e9225d05b35d61da6f70e7187ad3ce8d7c",
"4308087f2fbd90b5beaac53a71d6264684ee0c40"]
}
]
Same story for other commands.
With your jsonengine approach, this is going to be a real pain to
achieve. It'll mean modifying hgweb and every other style to make the
ancient internal hgweb element names and structures agree with what's
being done on the command line. Or, alternately, having a system to do
some transformations inside jsonengine.
But we've already got a templater for that. My position is still that we
should implement this by adding a mercurial/templates/json with a bunch
of boring templates like we have for raw. Same for xml.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list