Patchwork [4,of,4] templates: add support for graph webcommand in json style

login
register
mail settings
Submitter Laura Médioni
Date June 15, 2016, 12:06 p.m.
Message ID <7cc4229f0d6542d0db70.1465992368@sh79.dev.logilab.fr>
Download mbox | patch
Permalink /patch/15511/
State Changes Requested
Headers show

Comments

Laura Médioni - June 15, 2016, 12:06 p.m.
# HG changeset patch
# User Laura Médioni <laura.medioni@logilab.fr>
# Date 1465806567 -7200
#      Mon Jun 13 10:29:27 2016 +0200
# Node ID 7cc4229f0d6542d0db70f289a292a58b90d9f94d
# Parent  b7ea27cf0339ad30e00ac307af2e104cb2f2f106
templates: add support for graph webcommand in json style

Patch

diff --git a/mercurial/templates/json/map b/mercurial/templates/json/map
--- a/mercurial/templates/json/map
+++ b/mercurial/templates/json/map
@@ -195,11 +195,14 @@  filelog = '\{
 filelogentry = '\{
   "date": {date|json},
   "author": {author|utf8|json},
   "node": {node|json}
   }'
-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
@@ -1104,11 +1104,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