# HG changeset patch # User Laura Médioni # Date 2016-06-03 10:32:42 # Node ID 8bfe44494a0d662a1b1259c05e83fb094d050e1b # Parent c1b526f5511668bb4782249100b170f4e041a229 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,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. 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 @@ -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