changeset 24546:adfd808c123f

json: implement {bookmarks} template
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 31 Mar 2015 14:54:56 -0700
parents 9e0c67e84896
children 495f3e665b27
files mercurial/templates/json/map tests/test-hgweb-json.t
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/json/map	Tue Mar 31 14:52:21 2015 -0700
+++ b/mercurial/templates/json/map	Tue Mar 31 14:54:56 2015 -0700
@@ -14,7 +14,15 @@
   "node": {node|json},
   "date": {date|json}
   }'
-bookmarks = '"not yet implemented"'
+bookmarks = '\{
+  "node": {node|json},
+  "bookmarks": [{join(entries%bookmarkentry, ", ")}]
+  }'
+bookmarkentry = '\{
+  "bookmark": {bookmark|json},
+  "node": {node|json},
+  "date": {date|json}
+  }'
 branches = '"not yet implemented"'
 summary = '"not yet implemented"'
 filediff = '"not yet implemented"'
--- a/tests/test-hgweb-json.t	Tue Mar 31 14:52:21 2015 -0700
+++ b/tests/test-hgweb-json.t	Tue Mar 31 14:54:56 2015 -0700
@@ -191,7 +191,27 @@
   $ request json-bookmarks
   200 Script output follows
   
-  "not yet implemented"
+  {
+    "bookmarks": [
+      {
+        "bookmark": "bookmark1",
+        "date": [
+          0.0,
+          0
+        ],
+        "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
+      },
+      {
+        "bookmark": "bookmark2",
+        "date": [
+          0.0,
+          0
+        ],
+        "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
+      }
+    ],
+    "node": "6ab967a8ab3489227a83f80e920faa039a71819f"
+  }
 
 branches/ shows branches info