[PATCH 4 of 4] json: implement {fileannotate} template

Augie Fackler raf at durin42.com
Sat Apr 11 16:25:58 CDT 2015


On Fri, Apr 10, 2015 at 10:40:43PM -0400, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1428719860 14400
> #      Fri Apr 10 22:37:40 2015 -0400
> # Node ID caabf8dd0c2c055059be96269a4f79ea20b1e8de
> # Parent  cb1e30a5c4f4c8ebd09afc617e160c5de0e10362
> json: implement {fileannotate} template
>
> diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
> --- a/mercurial/templates/json/map
> +++ b/mercurial/templates/json/map
> @@ -133,9 +133,29 @@ comparisonline = '\{
>    "ll": {leftline|json},
>    "rn": {rightlineno|json},
>    "rl": {rightline|json}
>    }'
> -fileannotate = '"not yet implemented"'
> +fileannotate = '\{
> +  "abspath": {file|json},
> +  "node": {node|json},
> +  "author": {author|json},
> +  "date": {date|json},
> +  "desc": {desc|json},
> +  "parents": [{join(parent%changesetparent, ", ")}],
> +  "children": [{join(child%changesetparent, ", ")}],
> +  "permissions": {permissions|json},
> +  "annotate": [{join(annotate%fileannotation, ", ")}]
> +  }'
> +fileannotation = '\{
> +  "node": {node|json},
> +  "author": {author|json},
> +  "desc": {desc|json},
> +  "abspath": {file|json},
> +  "targetline": {targetline|json},
> +  "line": {line|json},
> +  "lineno": {lineno|json},

It seems somewhat redundant to have the line number when the lines
already end up in a list. Is there something I'm missing?

This is a small nit on an otherwise good series, so I'm going to queue
it and we can fix it in a followup.


> +  "revdate": {revdate|json}
> +  }'
>  filelog = '"not yet implemented"'
>  graph = '"not yet implemented"'
>  helptopics = '\{
>    "topics": [{join(topics%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
> @@ -764,9 +764,38 @@ annotate/{revision}/{path} shows annotat
>
>    $ request json-annotate/f8bbb9024b10/foo
>    200 Script output follows
>
> -  "not yet implemented"
> +  {
> +    "abspath": "foo",
> +    "annotate": [
> +      {
> +        "abspath": "foo",
> +        "author": "test",
> +        "desc": "modify foo",
> +        "line": "bar\n",
> +        "lineno": 1,
> +        "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
> +        "revdate": [
> +          0.0,
> +          0
> +        ],
> +        "targetline": 1
> +      }
> +    ],
> +    "author": "test",
> +    "children": [],
> +    "date": [
> +      0.0,
> +      0
> +    ],
> +    "desc": "modify foo",
> +    "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
> +    "parents": [
> +      "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
> +    ],
> +    "permissions": ""
> +  }
>
>  filelog/{revision}/{path} shows history of a single file
>
>    $ request json-filelog/f8bbb9024b10/foo
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list