changeset 24547:495f3e665b27

json: implement {branches} template
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 30 Mar 2015 21:37:24 -0700
parents adfd808c123f
children bcf0de51326e
files mercurial/templates/json/map tests/test-hgweb-json.t
diffstat 2 files changed, 31 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/json/map	Tue Mar 31 14:54:56 2015 -0700
+++ b/mercurial/templates/json/map	Mon Mar 30 21:37:24 2015 -0700
@@ -23,7 +23,15 @@
   "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"'
--- a/tests/test-hgweb-json.t	Tue Mar 31 14:54:56 2015 -0700
+++ b/tests/test-hgweb-json.t	Mon Mar 30 21:37:24 2015 -0700
@@ -218,7 +218,28 @@
   $ 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