From 205d244aa308764fc0dbe3d80d04b6f76eb4a9ac Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Fri, 10 Apr 2015 22:37:40 -0400 Subject: [PATCH] json: implement {fileannotate} template --- mercurial/templates/json/map | 22 +++++++++++++++++++++- tests/test-hgweb-json.t | 31 ++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map index 9f1ca4c0b6..6c2c9c2c8c 100644 --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -134,7 +134,27 @@ comparisonline = '\{ "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}, + "revdate": {revdate|json} + }' filelog = '"not yet implemented"' graph = '"not yet implemented"' helptopics = '\{ diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t index 0998868b96..a4c02c92f3 100644 --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -765,7 +765,36 @@ annotate/{revision}/{path} shows annotations for each line $ 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