doc: integrate graphviz graphs in tutorials
authorBoris Feld <boris.feld@octobus.net>
Thu, 21 Sep 2017 10:45:27 +0200
changeset 2959 ef361938dfa1
parent 2958 1cb715257130
child 2960 1a4f26eec0af
doc: integrate graphviz graphs in tutorials Use the mercurial-docgraph extension (https://pypi.python.org/pypi/hg- docgraph/) in tutorials in order to have some dot graphs in the tutorials .t files. Then generate the doc as usual, the sphinx-graphviz extension (http://www .sphinx-doc.org/en/stable/ext/graphviz.html) has been added and it should handle the generation of the graphs. Please be aware that you need the dot binary installed in your system. Please refer to the extension documentation for more configuration.
docs/README
docs/conf.py
docs/test2rst.py
tests/hghaveaddon.py
tests/test-topic-tutorial.t
tests/test-tutorial.t
tests/testlib/docgraph_setup.sh
--- a/docs/README	Thu Sep 21 10:45:06 2017 +0200
+++ b/docs/README	Thu Sep 21 10:45:27 2017 +0200
@@ -1,3 +1,22 @@
-doc generated with sphinx. tutorial exported using sphinxedhg
+Doc is generated with sphinx.
+
+You can generate the doc with:
+
+```
+make
+```
+
+# Tutorials
 
-http://hg.piranha.org.ua/sphinxedhg/
+For updating the tutorials, you need to have the docgraph extension installed
+(https://pypi.python.org/pypi/hg-docgraph).
+
+Then run the test-topic-tutorial.t and test-tutorial.t to update the output if
+needed.
+
+You'll need the dot binary (likely installed by the graphviz package in your
+package manager) in order to have graphviz graphs rendered in the html output.
+
+Simply run make in the docs directory should takes care of the conversion of
+the tutorial .t files into .rst files. Then sphinx should do the rest of the
+jobs by rendering graphviz graphs.
--- a/docs/conf.py	Thu Sep 21 10:45:06 2017 +0200
+++ b/docs/conf.py	Thu Sep 21 10:45:27 2017 +0200
@@ -1,6 +1,6 @@
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = []
+extensions = ["sphinx.ext.graphviz"]
 # autoclass_content = 'both'
 # Add any paths that contain templates here, relative to this directory.
 # templates_path = []
@@ -122,3 +122,5 @@
 
 # Output file base name for HTML help builder.
 # htmlhelp_basename = ''
+
+graphviz_output_format = "svg"
--- a/docs/test2rst.py	Thu Sep 21 10:45:06 2017 +0200
+++ b/docs/test2rst.py	Thu Sep 21 10:45:27 2017 +0200
@@ -17,25 +17,38 @@
     newlines = []
 
     code_block_mode = False
+    sphinx_directive_mode = False
 
     for line in orig.splitlines():
 
         # Emtpy lines doesn't change output
         if not line:
             newlines.append(line)
+            code_block_mode = False
+            sphinx_directive_mode = False
+            continue
 
         # Ignore line
         if line.endswith('#rest-ignore'):
             continue
 
+        # Sphinx directives mode
+        if line.startswith('  .. '):
+
+            # Insert a empty line to makes sphinx happy
+            newlines.append("")
+
+            # And unindent the directive
+            line = line[2:]
+            sphinx_directive_mode = True
+
+        # Code mode
         codeline = line.startswith('  ')
-        if codeline:
+        if codeline and not sphinx_directive_mode:
             if code_block_mode is False:
                 newlines.extend(['::', ''])
 
             code_block_mode = True
-        else:
-            code_block_mode = False
 
         newlines.append(line)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/hghaveaddon.py	Thu Sep 21 10:45:27 2017 +0200
@@ -0,0 +1,14 @@
+import hghave
+
+@hghave.check("docgraph-ext", "Extension to generate graph from repository")
+def docgraph():
+    try:
+        import hgext.docgraph
+        hgext.docgraph.cmdtable # trigger import
+    except ImportError:
+        try:
+            import hgext3rd.docgraph
+            hgext3rd.docgraph.cmdtable # trigger import
+        except ImportError:
+            return False
+    return True
--- a/tests/test-topic-tutorial.t	Thu Sep 21 10:45:06 2017 +0200
+++ b/tests/test-topic-tutorial.t	Thu Sep 21 10:45:27 2017 +0200
@@ -45,6 +45,9 @@
   > [ui]
   > user= Tutorial User
   > EOF
+#if docgraph-ext
+  $ . "$TESTDIR/testlib/docgraph_setup.sh" #rest-ignore
+#endif
 
 Topic branches are lightweight branches which disappear when changes are
 finalized (moved to the public phase). They can help users to organize and share
@@ -62,6 +65,27 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      }
+#endif
 
 We are about to make some additions to this list and would like to do them
 within a topic. Creating a new topic is done using the ``topic`` command:
@@ -90,6 +114,28 @@
      summary:     Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      }
+#endif
+
 Our next commit will be part of the active topic:
 
   $ cat >> shopping << EOF
@@ -110,6 +156,28 @@
      summary:     adding condiments
   
 
+#if docgraph-ext
+  $ hg docgraph -r "topic("food")" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 13900241408b",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      }
+#endif
+
 And future commits will be part of that topic too:
 
   $ cat >> shopping << EOF
@@ -135,6 +203,39 @@
      summary:     adding condiments
   
 
+#if docgraph-ext
+  $ hg docgraph -r "topic("food")" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 13900241408b",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	2	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="2: 287de11b401f",
+      		pin=true,
+      		pos="1,2!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 2;
+      }
+#endif
+
 We can get a compact view of the content of our topic using the ``stack``
 command:
 
@@ -175,6 +276,50 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     Shopping list
   
+
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 13900241408b",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	0 -> 1;
+      	2	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="2: 287de11b401f",
+      		pin=true,
+      		pos="1,2!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 2;
+      }
+#endif
 And updating back to the topic reactivates it:
 
   $ hg update food
@@ -253,6 +398,60 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 13900241408b",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	0 -> 1;
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 6104862e8b84",
+      		pin=true,
+      		pos="1,3!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 3;
+      	2	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="2: 287de11b401f",
+      		pin=true,
+      		pos="1,2!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 2;
+      }
+#endif
 
 The topic head will not be considered when merging from the new head of the
 branch:
@@ -303,6 +502,60 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 6104862e8b84",
+      		pin=true,
+      		pos="1,3!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 3;
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 4011b46eeb33",
+      		pin=true,
+      		pos="1,4!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	3 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: 2d50db8b5b4c",
+      		pin=true,
+      		pos="1,5!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      }
+#endif
 
 The topic information will disappear when we publish the changesets:
 
@@ -344,6 +597,61 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 6104862e8b84",
+      		pin=true,
+      		pos="1,3!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 3;
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 4011b46eeb33",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: 2d50db8b5b4c",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      }
+#endif
+
   $ hg update default
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -510,6 +818,138 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 6104862e8b84",
+      		pin=true,
+      		pos="1,3!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 3;
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 4011b46eeb33",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: 2d50db8b5b4c",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 183984ef46d1",
+      		pin=true,
+      		pos="1,6!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	9	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="9: 8dfa45bd5e0c",
+      		pin=true,
+      		pos="1,9!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	5 -> 9;
+      	11	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="11: f2d6cacc6115",
+      		pin=true,
+      		pos="1,11!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 11;
+      	7	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="7: cffff85af537",
+      		pin=true,
+      		pos="1,7!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	6 -> 7;
+      	8	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="8: 34255b455dac",
+      		pin=true,
+      		pos="1,8!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	7 -> 8;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: 70dfa201ed73",
+      		pin=true,
+      		pos="1,10!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	9 -> 10;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: fbff9bc37a43",
+      		pin=true,
+      		pos="1,12!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	11 -> 12;
+      }
+#endif
+
   $ hg rebase
   rebasing 6:183984ef46d1 "Adding hammer"
   merging shopping
@@ -708,6 +1148,99 @@
   ~  date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     add a pair of shoes
   
+
+#if docgraph-ext
+  $ hg docgraph -r "t0::" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: fbff9bc37a43",
+      		pin=true,
+      		pos="1,12!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	13	 [fillcolor="#DFDFFF",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="13: a8ab3599d53d",
+      		pin=true,
+      		pos="2,13!",
+      		shape=pentagon,
+      		style="dotted, filled",
+      		width=2];
+      	12 -> 13;
+      	18	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="18: b7509bd417f8",
+      		pin=true,
+      		pos="1,18!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	12 -> 18;
+      	16	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="16: 20759cb47ff8",
+      		pin=true,
+      		pos="1,16!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	12 -> 16;
+      	13 -> 18	 [arrowtail=dot,
+      		dir=back,
+      		minlen=0,
+      		style=dotted];
+      	14	 [fillcolor="#FF3535",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="14: d4f97f32f8a1",
+      		pin=true,
+      		pos="2,14!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	13 -> 14;
+      	15	 [fillcolor="#FF3535",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="15: bb1e6254f532",
+      		pin=true,
+      		pos="2,15!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	14 -> 15;
+      	17	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="17: 4cd7c1591a67",
+      		pin=true,
+      		pos="1,17!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	16 -> 17;
+      }
+#endif
+
 Fortunately stack shows you a better visualization:
 
   $ hg stack
@@ -787,6 +1320,83 @@
   ~  date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     add a pair of shoes
   
+
+#if docgraph-ext
+  $ hg docgraph -r "t0::" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: fbff9bc37a43",
+      		pin=true,
+      		pos="1,12!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	16	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="16: 20759cb47ff8",
+      		pin=true,
+      		pos="1,16!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	12 -> 16;
+      	18	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="18: b7509bd417f8",
+      		pin=true,
+      		pos="1,18!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	12 -> 18;
+      	17	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="17: 4cd7c1591a67",
+      		pin=true,
+      		pos="1,17!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	16 -> 17;
+      	19	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="19: d5c51ee5762a",
+      		pin=true,
+      		pos="1,19!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	18 -> 19;
+      	20	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="20: bae3758e46bf",
+      		pin=true,
+      		pos="1,20!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	19 -> 20;
+      }
+#endif
 Multi-headed stack
 ------------------
 
@@ -887,6 +1497,149 @@
      summary:     Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 38da43f0a2ea",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 6104862e8b84",
+      		pin=true,
+      		pos="1,3!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 3;
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 4011b46eeb33",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	3 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: 2d50db8b5b4c",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	11	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="11: f2d6cacc6115",
+      		pin=true,
+      		pos="1,11!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 11;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: fbff9bc37a43",
+      		pin=true,
+      		pos="1,12!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	11 -> 12;
+      	16	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="16: 20759cb47ff8",
+      		pin=true,
+      		pos="1,16!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	12 -> 16;
+      	18	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="18: b7509bd417f8",
+      		pin=true,
+      		pos="1,18!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	12 -> 18;
+      	17	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="17: 4cd7c1591a67",
+      		pin=true,
+      		pos="1,17!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	16 -> 17;
+      	19	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="19: d5c51ee5762a",
+      		pin=true,
+      		pos="1,19!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	18 -> 19;
+      	21	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="21: f936c6da9d61",
+      		pin=true,
+      		pos="1,21!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	18 -> 21;
+      	20	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="20: bae3758e46bf",
+      		pin=true,
+      		pos="1,20!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	19 -> 20;
+      }
+#endif
+
   $ hg up t4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
--- a/tests/test-tutorial.t	Thu Sep 21 10:45:06 2017 +0200
+++ b/tests/test-tutorial.t	Thu Sep 21 10:45:27 2017 +0200
@@ -65,6 +65,10 @@
   > rebase =
   > EOF
 
+#if docgraph-ext
+  $ . "$TESTDIR/testlib/docgraph_setup.sh" #rest-ignore
+#endif
+
 -----------------------
 Single Developer Usage
 -----------------------
@@ -125,6 +129,49 @@
   |
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 4d5dc8187023",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	0 -> 1;
+      	2	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="2: d85de4546133",
+      		pin=true,
+      		pos="1,2!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 2;
+      }
+#endif
 
 But a typo was made in Babanas!
 
@@ -159,6 +206,50 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 4d5dc8187023",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	0 -> 1;
+      	2	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="2: d85de4546133",
+      		pin=true,
+      		pos="1,2!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 2;
+      }
+#endif
+
 Hopefully. I can use `hg commit --amend` to rewrite my faulty changeset!
 
   $ sed -i'' -e s/Bananos/Banana/ shopping
@@ -185,6 +276,50 @@
   |
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 4d5dc8187023",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	0 -> 1;
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 9d0363b81950",
+      		pin=true,
+      		pos="1,3!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 3;
+      }
+#endif
+
   $ hg export tip
   # HG changeset patch
   # User test
@@ -239,6 +374,61 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	1	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="1: 4d5dc8187023",
+      		pin=true,
+      		pos="1,1!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	0 -> 1;
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	3	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="3: 9d0363b81950",
+      		pin=true,
+      		pos="1,3!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	1 -> 3;
+      }
+#endif
+
 Instead of merging my head with the new one. I'm going to rebase my work
 
   $ hg diff
@@ -260,6 +450,60 @@
   |
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      }
+#endif
 
 Removing changesets
 ------------------------
@@ -305,6 +549,61 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      }
+#endif
+
 Reordering changesets
 ------------------------
 
@@ -367,6 +666,83 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	8	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="8: 10b8aeaa8cc8",
+      		pin=true,
+      		pos="1,8!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	6 -> 8;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      }
+#endif
+
 We have a new SPAM SPAM version without the bathroom stuff
 
   $ grep Spam shopping  # enough spam
@@ -429,7 +805,82 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
-
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	11	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="11: 75954b8cd933",
+      		pin=true,
+      		pos="1,11!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 11;
+      }
+#endif
 
 Splitting change
 ------------------
@@ -640,6 +1091,83 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: a44c85f957d3",
+      		pin=true,
+      		pos="1,12!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 12;
+      }
+#endif
+
 When we pull from remote again we get an unstable state!
 
   $ hg pull remote
@@ -674,6 +1202,109 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	11	 [fillcolor="#DFDFFF",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="11: 75954b8cd933",
+      		pin=true,
+      		pos="2,11!",
+      		shape=pentagon,
+      		style="dotted, filled",
+      		width=2];
+      	10 -> 11;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: a44c85f957d3",
+      		pin=true,
+      		pos="1,12!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 12;
+      	11 -> 12	 [arrowtail=dot,
+      		dir=back,
+      		minlen=0,
+      		style=dotted];
+      	13	 [fillcolor="#FF3535",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="13: bf1b0d202029",
+      		pin=true,
+      		pos="2,13!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	11 -> 13;
+      }
+#endif
+
 The older version 75954b8cd933 never ceased to exist in the local repo. It was
 just hidden and excluded from pull and push.
 
@@ -726,6 +1357,94 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: a44c85f957d3",
+      		pin=true,
+      		pos="1,12!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 12;
+      	14	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="14: ee942144f952",
+      		pin=true,
+      		pos="1,14!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	12 -> 14;
+      }
+#endif
+
 We can push this evolution to remote.
 
   $ hg push remote
@@ -797,6 +1516,105 @@
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
 
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: a44c85f957d3",
+      		pin=true,
+      		pos="1,12!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 12;
+      	14	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="14: ee942144f952",
+      		pin=true,
+      		pos="1,14!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	12 -> 14;
+      	15	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="15: 99f039c5ec9e",
+      		pin=true,
+      		pos="1,15!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	14 -> 15;
+      }
+#endif
+
 In the mean time I noticed you can't buy animals in a super market and I prune the animal changeset:
 
   $ hg prune ee942144f952
@@ -826,9 +1644,131 @@
   |
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
+
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: a44c85f957d3",
+      		pin=true,
+      		pos="1,12!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 12;
+      	14	 [fillcolor="#DFDFFF",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="14: ee942144f952",
+      		pin=true,
+      		pos="2,14!",
+      		shape=pentagon,
+      		style="dotted, filled",
+      		width=2];
+      	12 -> 14;
+      	15	 [fillcolor="#FF3535",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="15: 99f039c5ec9e",
+      		pin=true,
+      		pos="2,15!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	14 -> 15;
+      }
+#endif
+
   $ hg log -r "orphan()"
   99f039c5ec9e (draft): SPAM SPAM SPAM
 
+#if docgraph-ext
+  $ hg docgraph -r "orphan()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	15	 [fillcolor="#FF3535",
+      		fixedsize=true,
+      		group=default_alt,
+      		height=2,
+      		label="15: 99f039c5ec9e",
+      		pin=true,
+      		pos="1,15!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      }
+#endif
+
   $ hg evolve
   move:[15] SPAM SPAM SPAM
   atop:[12] bathroom stuff
@@ -850,6 +1790,95 @@
   |
   o  7e82d3f3c2cb (public): Monthy Python Shopping list
   
+
+#if docgraph-ext
+  $ hg docgraph -r "all()" --sphinx-directive --rankdir LR #rest-ignore
+  .. graphviz::
+  
+      strict digraph  {
+      	graph [rankdir=LR,
+      		splines=polyline
+      	];
+      	node [label="\N"];
+      	0	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="0: 7e82d3f3c2cb",
+      		pin=true,
+      		pos="1,0!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="4: 9ca060c80d74",
+      		pin=true,
+      		pos="1,4!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	0 -> 4;
+      	5	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="5: dfd3a2d7691e",
+      		pin=true,
+      		pos="1,5!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	4 -> 5;
+      	6	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="6: 41aff6a42b75",
+      		pin=true,
+      		pos="1,6!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	5 -> 6;
+      	10	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="10: a224f2a4fb9f",
+      		pin=true,
+      		pos="1,10!",
+      		shape=circle,
+      		style=filled,
+      		width=2];
+      	6 -> 10;
+      	12	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="12: a44c85f957d3",
+      		pin=true,
+      		pos="1,12!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	10 -> 12;
+      	16	 [fillcolor="#7F7FFF",
+      		fixedsize=true,
+      		group=default,
+      		height=2,
+      		label="16: 40aa40daeefb",
+      		pin=true,
+      		pos="1,16!",
+      		shape=pentagon,
+      		style=filled,
+      		width=2];
+      	12 -> 16;
+      }
+#endif
+
 Handling Divergent amend
 ----------------------------------------------
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/testlib/docgraph_setup.sh	Thu Sep 21 10:45:27 2017 +0200
@@ -0,0 +1,6 @@
+. $TESTDIR/testlib/pythonpath.sh
+
+cat >> $HGRCPATH << EOF
+[extensions]
+docgraph=
+EOF