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

Laura Médioni laura.medioni at logilab.fr
Wed Jun 15 10:48:22 EDT 2016


# HG changeset patch
# User Laura Médioni <laura.medioni at logilab.fr>
# Date 1465806567 -7200
#      Mon Jun 13 10:29:27 2016 +0200
# Node ID 9fc3e7b7ea8f8d77e4167dfa5c63ee2c37d3690d
# Parent  33c362973b2ab07b2e20d6818b7e72473e682fd4
templates: add support for graph 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
@@ -191,11 +191,14 @@ fileannotation = '\{
   "revdate": {revdate|json}
   }'
 filelog = '\{
   "entries": [{join(entries%changeset, ", ")}]
   }'
-graph = '"not yet implemented"'
+graph = '\{
+  "node": {node|json},
+  "graphdata": {jsdata|json}
+  }'
 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
@@ -1335,11 +1335,330 @@ filelog/{revision}/{path} shows history 
 graph/ shows information that can be used to render a graph of the DAG
 
   $ request json-graph
   200 Script output follows
   
-  "not yet implemented"
+  {
+    "graphdata": [
+      [
+        "cc725e08502a",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            0,
+            1,
+            1,
+            -1,
+            ""
+          ]
+        ],
+        "merge test-branch into default",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          true
+        ],
+        [
+          "tip"
+        ],
+        []
+      ],
+      [
+        "ed66c30e87eb",
+        [
+          1,
+          2
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "another commit in test-branch",
+        "test",
+        "1970-01-01",
+        [
+          "test-branch",
+          true
+        ],
+        [],
+        []
+      ],
+      [
+        "6ab967a8ab34",
+        [
+          1,
+          2
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "create test branch",
+        "test",
+        "1970-01-01",
+        [
+          "test-branch",
+          false
+        ],
+        [],
+        []
+      ],
+      [
+        "ceed296fe500",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "create tag2",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [],
+        [
+          "bookmark2"
+        ]
+      ],
+      [
+        "f2890a05fea4",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "another commit to da/foo",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [
+          "tag2"
+        ],
+        []
+      ],
+      [
+        "93a8ce14f891",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "create tag",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [],
+        []
+      ],
+      [
+        "78896eb0e102",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "move foo",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [
+          "tag1"
+        ],
+        []
+      ],
+      [
+        "8d7c456572ac",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            1,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "modify da/foo",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [],
+        [
+          "bookmark1"
+        ]
+      ],
+      [
+        "f8bbb9024b10",
+        [
+          0,
+          1
+        ],
+        [
+          [
+            0,
+            0,
+            1,
+            -1,
+            ""
+          ],
+          [
+            1,
+            0,
+            2,
+            -1,
+            ""
+          ]
+        ],
+        "modify foo",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [],
+        []
+      ],
+      [
+        "06e557f3edf6",
+        [
+          0,
+          2
+        ],
+        [],
+        "initial",
+        "test",
+        "1970-01-01",
+        [
+          "default",
+          false
+        ],
+        [],
+        []
+      ]
+    ],
+    "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
+  }
 
 help/ shows help topics
 
   $ request json-help
   200 Script output follows


More information about the Mercurial-devel mailing list