changeset 29383:f3dca85bd2d1

templates: add support for search webcommand in json style
author Laura Médioni <laura.medioni@logilab.fr>
date Fri, 10 Jun 2016 10:31:42 +0200
parents e4b777fe1576
children c75c8ea2f573
files mercurial/templates/json/map tests/test-hgweb-json.t
diffstat 2 files changed, 66 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/json/map	Mon Jun 06 15:14:11 2016 +0200
+++ b/mercurial/templates/json/map	Fri Jun 10 10:31:42 2016 +0200
@@ -15,7 +15,12 @@
 lineentry = '\{
   "line": {line|json}
   }'
-search = '"not yet implemented"'
+search = '\{
+  "node": {node|json},
+  "query": {query|json},
+  "entries": [{join(entries%searchentry, ", ")}]
+  }'
+searchentry = '{changelistentry}'
 # changelog and shortlog are the same web API but with different
 # number of entries.
 changelog = changelist.tmpl
--- a/tests/test-hgweb-json.t	Mon Jun 06 15:14:11 2016 +0200
+++ b/tests/test-hgweb-json.t	Fri Jun 10 10:31:42 2016 +0200
@@ -1035,6 +1035,66 @@
     ]
   }
 
+  $ request json-changelog?rev=create
+  200 Script output follows
+  
+  {
+    "entries": [
+      {
+        "bookmarks": [],
+        "branch": "test-branch",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "create test branch",
+        "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
+        "parents": [
+          "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
+        ],
+        "phase": "draft",
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [
+          "bookmark2"
+        ],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "create tag2",
+        "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
+        "parents": [
+          "f2890a05fea49bfaf9fb27ed5490894eba32da78"
+        ],
+        "phase": "draft",
+        "tags": [],
+        "user": "test"
+      },
+      {
+        "bookmarks": [],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "create tag",
+        "node": "93a8ce14f89156426b7fa981af8042da53f03aa0",
+        "parents": [
+          "78896eb0e102174ce9278438a95e12543e4367a7"
+        ],
+        "phase": "public",
+        "tags": [],
+        "user": "test"
+      }
+    ],
+    "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
+    "query": "create"
+  }
+
 filediff/{revision}/{path} shows changes to a file in a revision
 
   $ request json-diff/f8bbb9024b10/foo