Mercurial > hg
changeset 29381:8bfe44494a0d
templates: add support for filerevision webcommand in json style
author | Laura Médioni <laura.medioni@logilab.fr> |
---|---|
date | Fri, 03 Jun 2016 12:32:42 +0200 |
parents | c1b526f55116 |
children | e4b777fe1576 |
files | mercurial/templates/json/map tests/test-hgweb-json.t |
diffstat | 2 files changed, 41 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templates/json/map Fri Jun 03 11:28:22 2016 +0200 +++ b/mercurial/templates/json/map Fri Jun 03 12:32:42 2016 +0200 @@ -1,5 +1,20 @@ 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(bookmarks%changelistentryname, ", ")}], + "tags": [{join(tags%changelistentryname, ", ")}], + "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.
--- a/tests/test-hgweb-json.t Fri Jun 03 11:28:22 2016 +0200 +++ b/tests/test-hgweb-json.t Fri Jun 03 12:32:42 2016 +0200 @@ -111,10 +111,33 @@ file/{revision}/{path} shows file revision - $ request json-file/06e557f3edf6/foo + $ request json-file/78896eb0e102/foo-new 200 Script output follows - "not yet implemented" + { + "bookmarks": [], + "branch": "default", + "date": [ + 0.0, + 0 + ], + "desc": "move foo", + "lines": [ + { + "line": "bar\n" + } + ], + "node": "78896eb0e102174ce9278438a95e12543e4367a7", + "parents": [ + "f8bbb9024b10f93cdbb8d940337398291d40dea8" + ], + "path": "foo-new", + "phase": "public", + "tags": [ + "tag1" + ], + "user": "test" + } file/{revision} shows root directory info