json: implement {branches} template
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 30 Mar 2015 21:37:24 -0700
changeset 24547 495f3e665b27
parent 24546 adfd808c123f
child 24549 bcf0de51326e
json: implement {branches} template
mercurial/templates/json/map
tests/test-hgweb-json.t
--- 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