changeset 43717:6feaee05bac5

hgweb: add files to the json changeset template As far as I can tell, it's currently impossible via JSON to figure out what files are touched by a particular revision. Reusing the filenodelink and filenolink templates from the other hgweb templates should provide this information.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Fri, 15 Nov 2019 15:56:25 -0500
parents 33cff871d3b9
children d155bf11cf22
files mercurial/templates/json/map tests/test-hgweb-json.t
diffstat 2 files changed, 34 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templates/json/map	Fri Nov 15 16:02:01 2019 -0500
+++ b/mercurial/templates/json/map	Fri Nov 15 15:56:25 2019 -0500
@@ -65,6 +65,7 @@
   "tags": [{join(changesettag, ", ")}],
   "user": {author|utf8|json},
   "parents": [{join(parent%changesetparent, ", ")}],
+  "files": [{join(files, ", ")}],
   "phase": {phase|json}
   }'
 changesetbranch = '{name|utf8|json}'
@@ -229,8 +230,11 @@
   "topic": {topic|utf8|json},
   "rawdoc": {doc|utf8|json}
   }'
-filenodelink = ''
-filenolink = ''
+filenodelink = '\{
+  "file": {file|json},
+  "status": {status|json}
+  }'
+filenolink = '{filenodelink}'
 index = '\{
   "entries": [{join(entries%indexentry, ", ")}]
   }'
--- a/tests/test-hgweb-json.t	Fri Nov 15 16:02:01 2019 -0500
+++ b/tests/test-hgweb-json.t	Fri Nov 15 15:56:25 2019 -0500
@@ -782,6 +782,12 @@
       0
     ],
     "desc": "merge test-branch into default",
+    "files": [
+      {
+        "file": "foo-new",
+        "status": "modified"
+      }
+    ],
     "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
     "parents": [
       "ceed296fe500c3fac9541e31dad860cb49c89e45",
@@ -807,6 +813,16 @@
       0
     ],
     "desc": "move foo",
+    "files": [
+      {
+        "file": "foo",
+        "status": "removed"
+      },
+      {
+        "file": "foo-new",
+        "status": "added"
+      }
+    ],
     "node": "78896eb0e102174ce9278438a95e12543e4367a7",
     "parents": [
       "8d7c456572acf3557e8ed8a07286b10c408bcec5"
@@ -833,6 +849,12 @@
       0
     ],
     "desc": "modify da/foo",
+    "files": [
+      {
+        "file": "da/foo",
+        "status": "modified"
+      }
+    ],
     "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
     "parents": [
       "f8bbb9024b10f93cdbb8d940337398291d40dea8"
@@ -855,6 +877,12 @@
       0
     ],
     "desc": "create test branch",
+    "files": [
+      {
+        "file": "foo",
+        "status": "modified"
+      }
+    ],
     "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
     "parents": [
       "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"