Add a "jsoninfo" command to get information about an arbitrary revision without having to retrieve parents.
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 14 Apr 2008 11:52:56 -0400
changeset 16 c428ff46384ed484dea0135bb9f3aa3f1a144628
parent 15 9238af9c1accb616c0367c5227c0d529dbe98a0a
child 17 1115da66d337923f24189093db17c44e8fbe9414
push id2
push userbsmedberg@mozilla.com
push dateMon, 14 Apr 2008 21:07:23 +0000
Add a "jsoninfo" command to get information about an arbitrary revision without having to retrieve parents.
hgwebjson.py
--- a/hgwebjson.py
+++ b/hgwebjson.py
@@ -110,8 +110,21 @@ def family(web, req):
 
     e = HGJSONEncoder(web.repo)
     resp = e.encode({'context': hex(ctx.node()),
                      'nodes': nodelist})
     req.respond(HTTP_OK, JSON_MIMETYPE, length=len(resp))
     req.write(resp)
 
 addwebcommand(family, 'jsonfamily')    
+
+def info(web, req):
+    """Get JSON information about the specified nodes."""
+    e = HGJSONEncoder(web.repo)
+    d = {}
+    for node in req.form['node']:
+        d[node] = web.repo.changectx(node)
+
+    resp = e.encode(d)
+    req.respond(HTTP_OK, JSON_MIMETYPE, length=len(resp))
+    req.write(resp)
+
+addwebcommand(info, 'jsoninfo')