# HG changeset patch # User Gregory Szorc # Date 2015-03-31 04:37:24 # Node ID 495f3e665b275eed770c285a76eeacaef32551c6 # Parent adfd808c123f5e96d0c6c031cf0e465f2858a3fc json: implement {branches} template diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map --- a/mercurial/templates/json/map +++ b/mercurial/templates/json/map @@ -23,7 +23,15 @@ bookmarkentry = '\{ "node": {node|json}, "date": {date|json} }' -branches = '"not yet implemented"' +branches = '\{ + "branches": [{join(entries%branchentry, ", ")}] + }' +branchentry = '\{ + "branch": {branch|json}, + "node": {node|json}, + "date": {date|json}, + "status": {status|json} + }' summary = '"not yet implemented"' filediff = '"not yet implemented"' filecomparison = '"not yet implemented"' 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 @@ -218,7 +218,28 @@ branches/ shows branches info $ request json-branches 200 Script output follows - "not yet implemented" + { + "branches": [ + { + "branch": "test-branch", + "date": [ + 0.0, + 0 + ], + "node": "6ab967a8ab3489227a83f80e920faa039a71819f", + "status": "open" + }, + { + "branch": "default", + "date": [ + 0.0, + 0 + ], + "node": "ceed296fe500c3fac9541e31dad860cb49c89e45", + "status": "open" + } + ] + } summary/ shows a summary of repository state