[PATCH] templates: add support for filelog webcommand in json style

Anton Shestakov engored at ya.ru
Wed Jun 15 08:38:19 EDT 2016


15.06.2016, 20:21, "Laura Médioni" <laura.medioni at logilab.fr>:
> # HG changeset patch
> # User Laura Médioni <laura.medioni at logilab.fr>
> # Date 1464946102 -7200
> # Fri Jun 03 11:28:22 2016 +0200
> # Node ID bfd47c239e711d1010e12dad8e76d1c3bdfe2a0d
> # Parent 48b38b16a8f83ea98ebdf0b370f59fd90dc17935
> templates: add support for filelog 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
> @@ -154,11 +154,18 @@ fileannotation = '\{
>    "targetline": {targetline|json},
>    "line": {line|json},
>    "lineno": {lineno|json},
>    "revdate": {revdate|json}
>    }'
> -filelog = '"not yet implemented"'
> +filelog = '\{
> + "entries": [{join(entries%filelogentry, ", ")}]
> + }'
> +filelogentry = '\{
> + "date": {date|json},
> + "author": {author|utf8|json},
> + "node": {node|json}
> + }'

Here too, any reason not to use existing templates that expose changeset data like branch, tags, bookmarks, description... ?

>  graph = '"not yet implemented"'
>  helptopics = '\{
>    "topics": [{join(topics%helptopicentry, ", ")}],
>    "earlycommands": [{join(earlycommands%helptopicentry, ", ")}],
>    "othercommands": [{join(othercommands%helptopicentry, ", ")}]
> 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
> @@ -860,11 +860,62 @@ annotate/{revision}/{path} shows annotat
>  filelog/{revision}/{path} shows history of a single file
>
>    $ request json-filelog/f8bbb9024b10/foo
>    200 Script output follows
>
> - "not yet implemented"
> + {
> + "entries": [
> + {
> + "author": "test",
> + "date": [
> + 0.0,
> + 0
> + ],
> + "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8"
> + },
> + {
> + "author": "test",
> + "date": [
> + 0.0,
> + 0
> + ],
> + "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
> + }
> + ]
> + }
> +
> + $ request json-filelog/cc725e08502a/da/foo
> + 200 Script output follows
> +
> + {
> + "entries": [
> + {
> + "author": "test",
> + "date": [
> + 0.0,
> + 0
> + ],
> + "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78"
> + },
> + {
> + "author": "test",
> + "date": [
> + 0.0,
> + 0
> + ],
> + "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
> + },
> + {
> + "author": "test",
> + "date": [
> + 0.0,
> + 0
> + ],
> + "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
> + }
> + ]
> + }
>
>  (archive/ doesn't use templating, so ignore it)
>
>  (static/ doesn't use templating, so ignore it)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list