[PATCH 1 of 5 V2] templates: add support for filelog webcommand in json style

Laura Médioni laura.medioni at logilab.fr
Wed Jun 15 14:48:18 UTC 2016


# HG changeset patch
# User Laura Médioni <laura.medioni at logilab.fr>
# Date 1464946102 -7200
#      Fri Jun 03 11:28:22 2016 +0200
# Node ID 2acea25d7060ffed14c2310327e625151bcd2a21
# Parent  48b38b16a8f83ea98ebdf0b370f59fd90dc17935
templates: add support for filelog webcommand in json style

diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
--- a/mercurial/templates/json/map
+++ b/mercurial/templates/json/map
@@ -154,11 +154,13 @@ fileannotation = '\{
   "targetline": {targetline|json},
   "line": {line|json},
   "lineno": {lineno|json},
   "revdate": {revdate|json}
   }'
-filelog = '"not yet implemented"'
+filelog = '\{
+  "entries": [{join(entries%changeset, ", ")}]
+  }'
 graph = '"not yet implemented"'
 helptopics = '\{
   "topics": [{join(topics%helptopicentry, ", ")}],
   "earlycommands": [{join(earlycommands%helptopicentry, ", ")}],
   "othercommands": [{join(othercommands%helptopicentry, ", ")}]
diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t
--- a/tests/test-hgweb-json.t
+++ b/tests/test-hgweb-json.t
@@ -860,11 +860,118 @@ annotate/{revision}/{path} shows annotat
 filelog/{revision}/{path} shows history of a single file
 
   $ request json-filelog/f8bbb9024b10/foo
   200 Script output follows
   
-  "not yet implemented"
+  {
+    "entries": [
+      {
+        "bookmarks": [
+          ""
+        ],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "modify foo",
+        "node": "f8bbb9024b10f93cdbb8d940337398291d40dea8",
+        "parents": [
+          "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
+        ],
+        "phase": "public",
+        "tags": [
+          ""
+        ],
+        "user": "test"
+      },
+      {
+        "bookmarks": [
+          ""
+        ],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "initial",
+        "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
+        "parents": [],
+        "phase": "public",
+        "tags": [
+          ""
+        ],
+        "user": "test"
+      }
+    ]
+  }
+
+  $ request json-filelog/cc725e08502a/da/foo
+  200 Script output follows
+  
+  {
+    "entries": [
+      {
+        "bookmarks": [
+          ""
+        ],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "another commit to da/foo",
+        "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
+        "parents": [
+          "8d7c456572acf3557e8ed8a07286b10c408bcec5"
+        ],
+        "phase": "draft",
+        "tags": [
+          ""
+        ],
+        "user": "test"
+      },
+      {
+        "bookmarks": [
+          ""
+        ],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "modify da/foo",
+        "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
+        "parents": [
+          "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
+        ],
+        "phase": "public",
+        "tags": [
+          ""
+        ],
+        "user": "test"
+      },
+      {
+        "bookmarks": [
+          ""
+        ],
+        "branch": "default",
+        "date": [
+          0.0,
+          0
+        ],
+        "desc": "initial",
+        "node": "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e",
+        "parents": [],
+        "phase": "public",
+        "tags": [
+          ""
+        ],
+        "user": "test"
+      }
+    ]
+  }
 
 (archive/ doesn't use templating, so ignore it)
 
 (static/ doesn't use templating, so ignore it)
 


More information about the Mercurial-devel mailing list