[PATCH 2 of 5 V2] templates: add support for filerevision webcommand in json style

Anton Shestakov engored at ya.ru
Thu Jun 16 06:04:52 EDT 2016


15.06.2016, 22:48, "Laura Médioni" <laura.medioni at logilab.fr>:
> # HG changeset patch
> # User Laura Médioni <laura.medioni at logilab.fr>
> # Date 1464949962 -7200
> # Fri Jun 03 12:32:42 2016 +0200
> # Node ID 3f9f7b7fb8e5233b057f32ef9caf930f3ea4f28c
> # Parent 2acea25d7060ffed14c2310327e625151bcd2a21
> templates: add support for filerevision webcommand in json style
>
> diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
> --- a/mercurial/templates/json/map
> +++ b/mercurial/templates/json/map
> @@ -1,7 +1,22 @@
>  mimetype = 'application/json'
> -filerevision = '"not yet implemented"'
> +filerevision = '\{
> + "node": {node|json},
> + "path": {file|json},
> + "date": {date|json},
> + "desc": {desc|utf8|json},
> + "branch": {if(branch, branch%changesetbranch, "default"|json)},
> + "bookmarks": [{join(changesetbookmark, ", ")}],
> + "tags": [{join(changesettag, ", ")}],

Notice how this produces incorrect data in tags and bookmarks in json (probably for the same reasons given in patch 1 feedback).

> + "user": {author|utf8|json},
> + "parents": [{join(parent%changesetparent, ", ")}],
> + "phase": {phase|json},
> + "lines": [{join(text%lineentry, ", ")}]
> + }'
> +lineentry = '\{
> + "line": {line|json}
> + }'
>  search = '"not yet implemented"'
>  # changelog and shortlog are the same web API but with different
>  # number of entries.
>  changelog = changelist.tmpl
>  shortlog = changelist.tmpl
> diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t
> --- a/tests/test-hgweb-json.t
> +++ b/tests/test-hgweb-json.t
> @@ -112,11 +112,34 @@
>  file/{revision}/{path} shows file revision
>
>    $ request json-file/06e557f3edf6/foo
>    200 Script output follows
>
> - "not yet implemented"
> + {
> + "bookmarks": [
> + ""
> + ],
> + "branch": "default",
> + "date": [
> + 0.0,
> + 0
> + ],
> + "desc": "initial",
> + "lines": [
> + {
> + "line": "foo\n"
> + }
> + ],
> + "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
> + "parents": [],
> + "path": "foo",
> + "phase": "public",
> + "tags": [
> + ""
> + ],
> + "user": "test"
> + }


More information about the Mercurial-devel mailing list