Commits

Peter Arrenbrecht committed aff85f2

convert tutorial to rst and run-tests.py

Comments (0)

Files changed (31)

 syntax: re
 
-^tut/build/
-^hg
-^mercurial
-^hgext
+^sdoc/_build
+^tests/.*[.]err
 
+syntax: glob
+*.pyc
+
+PYTHON=python
+
+help:
+	@echo 'Commonly used make targets:'
+	@echo '  tests              - run all tests in the automatic test suite'
+	@echo '  test-%s            - run a specific test'
+	@echo '  tests-%s           - run all tests in the specified hg version'
+	@echo '  all-version-tests  - run all tests against many hg versions'
+
+all: help
+
+.PHONY: tests
+
+tests:
+	@echo "Path to hg repo is $(TESTHG) - set this with TESTHG= if needed."
+	cd tests && $(PYTHON) $(TESTHG)/tests/run-tests.py $(TESTFLAGS)
+
+test-%:
+	@echo "Path to hg repo is $(TESTHG) - set this with TESTHG= if needed."
+	cd tests && $(PYTHON) $(TESTHG)/tests/run-tests.py $(TESTFLAGS) $@
+
+tests-%:
+	@echo "Path to hg repo is $(TESTHG) - set this with TESTHG= if needed."
+	hg -R $(TESTHG) checkout $$(echo $@ | sed s/tests-//) && \
+	(cd $(TESTHG) ; $(MAKE) clean ) && \
+	cd tests && $(PYTHON) $(TESTHG)/tests/run-tests.py $(TESTFLAGS)
+
+# requires at least 1.7 because of use of unified tests
+all-version-tests: tests-1.9.1 tests-tip

hgext/__init__.py

+# placeholder

local-hg

-#! /bin/bash
-
-HGRCPATH=/tmp/none ./hg \
-	--config extensions.hgext.evolution= \
-	--config extensions.hgext.graphlog= \
-	--config extensions.hgext.color= \
-	$@
-
+hg-repo/mercurial
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MercurialChangesetEvolution.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MercurialChangesetEvolution.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/MercurialChangesetEvolution"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MercurialChangesetEvolution"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."

sdoc/_static/default.css

+/**
+ * Alternate Sphinx design
+ * Originally created by Armin Ronacher for Werkzeug, adapted by Georg Brandl.
+ */
+
+body {
+    font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;
+    font-size: 14px;
+    letter-spacing: -0.01em;
+    line-height: 150%;
+    text-align: center;
+    /*background-color: #AFC1C4; */
+    background-color: #BFD1D4;
+    color: black;
+    padding: 0;
+    border: 1px solid #aaa;
+
+    margin: 0px 80px 0px 80px;
+    min-width: 78em;
+}
+
+a {
+    color: #CA7900;
+    text-decoration: none;
+}
+
+a:hover {
+    color: #2491CF;
+}
+
+pre {
+    font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+    font-size: 0.95em;
+    letter-spacing: 0.015em;
+    padding: 0.5em;
+    border: 1px solid #ccc;
+    background-color: #f8f8f8;
+}
+
+td.linenos pre {
+    padding: 0.5em 0;
+    border: 0;
+    background-color: transparent;
+    color: #aaa;
+}
+
+table.highlighttable {
+    margin-left: 0.5em;
+}
+
+table.highlighttable td {
+    padding: 0 0.5em 0 0.5em;
+}
+
+cite, code, tt {
+    font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+    font-size: 0.95em;
+    letter-spacing: 0.01em;
+}
+
+hr {
+    border: 1px solid #abc;
+    margin: 2em;
+}
+
+tt {
+    background-color: #f2f2f2;
+    border-bottom: 1px solid #ddd;
+    color: #333;
+}
+
+tt.descname {
+    background-color: transparent;
+    font-weight: bold;
+    font-size: 1.2em;
+    border: 0;
+}
+
+tt.descclassname {
+    background-color: transparent;
+    border: 0;
+}
+
+tt.xref {
+    background-color: transparent;
+    font-weight: bold;
+    border: 0;
+}
+
+a tt {
+    background-color: transparent;
+    font-weight: bold;
+    border: 0;
+    color: #CA7900;
+}
+
+a tt:hover {
+    color: #2491CF;
+}
+
+dl {
+    margin-bottom: 15px;
+}
+
+dd p {
+    margin-top: 0px;
+}
+
+dd ul, dd table {
+    margin-bottom: 10px;
+}
+
+dd {
+    margin-top: 3px;
+    margin-bottom: 10px;
+    margin-left: 30px;
+}
+
+.refcount {
+    color: #060;
+}
+
+dt:target,
+.highlight {
+    background-color: #fbe54e;
+}
+
+dl.class, dl.function {
+    border-top: 2px solid #888;
+}
+
+dl.method, dl.attribute {
+    border-top: 1px solid #aaa;
+}
+
+dl.glossary dt {
+    font-weight: bold;
+    font-size: 1.1em;
+}
+
+pre {
+    line-height: 120%;
+}
+
+pre a {
+    color: inherit;
+    text-decoration: underline;
+}
+
+.first {
+    margin-top: 0 !important;
+}
+
+div.document {
+    background-color: white;
+    text-align: left;
+    background-image: url(contents.png);
+    background-repeat: repeat-x;
+}
+
+/*
+div.documentwrapper {
+    width: 100%;
+}
+*/
+
+div.clearer {
+    clear: both;
+}
+
+div.related h3 {
+    display: none;
+}
+
+div.related ul {
+    background-image: url(navigation.png);
+    height: 2em;
+    list-style: none;
+    border-top: 1px solid #ddd;
+    border-bottom: 1px solid #ddd;
+    margin: 0;
+    padding-left: 10px;
+}
+
+div.related ul li {
+    margin: 0;
+    padding: 0;
+    height: 2em;
+    float: left;
+}
+
+div.related ul li.right {
+    float: right;
+    margin-right: 5px;
+}
+
+div.related ul li a {
+    margin: 0;
+    padding: 0 5px 0 5px;
+    line-height: 1.75em;
+    color: #EE9816;
+}
+
+div.related ul li a:hover {
+    color: #3CA8E7;
+}
+
+div.body {
+    margin: 0;
+    padding: 0.5em 20px 20px 20px;
+}
+
+div.bodywrapper {
+    margin: 0 240px 0 0;
+    border-right: 1px solid #ccc;
+}
+
+div.body a {
+    text-decoration: underline;
+}
+
+div.sphinxsidebar {
+    margin: 0;
+    padding: 0.5em 15px 15px 0;
+    width: 210px;
+    float: right;
+    text-align: left;
+/*    margin-left: -100%; */
+}
+
+div.sphinxsidebar h4, div.sphinxsidebar h3 {
+    margin: 1em 0 0.5em 0;
+    font-size: 0.9em;
+    padding: 0.1em 0 0.1em 0.5em;
+    color: white;
+    border: 1px solid #86989B;
+    background-color: #AFC1C4;
+}
+
+div.sphinxsidebar ul {
+    padding-left: 1.5em;
+    margin-top: 7px;
+    list-style: none;
+    padding: 0;
+    line-height: 130%;
+}
+
+div.sphinxsidebar ul ul {
+    list-style: square;
+    margin-left: 20px;
+}
+
+p {
+    margin: 0.8em 0 0.5em 0;
+}
+
+p.rubric {
+    font-weight: bold;
+}
+
+h1 {
+    margin: 0;
+    padding: 0.7em 0 0.3em 0;
+    font-size: 1.5em;
+    color: #11557C;
+}
+
+h2 {
+    margin: 1.3em 0 0.2em 0;
+    font-size: 1.35em;
+    padding: 0;
+}
+
+h3 {
+    margin: 1em 0 -0.3em 0;
+    font-size: 1.2em;
+}
+
+h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
+    color: black!important;
+}
+
+h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor {
+    display: none;
+    margin: 0 0 0 0.3em;
+    padding: 0 0.2em 0 0.2em;
+    color: #aaa!important;
+}
+
+h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor,
+h5:hover a.anchor, h6:hover a.anchor {
+    display: inline;
+}
+
+h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover,
+h5 a.anchor:hover, h6 a.anchor:hover {
+    color: #777;
+    background-color: #eee;
+}
+
+table {
+    border-collapse: collapse;
+    margin: 0 -0.5em 0 -0.5em;
+}
+
+table td, table th {
+    padding: 0.2em 0.5em 0.2em 0.5em;
+}
+
+div.footer {
+    background-color: #E3EFF1;
+    color: #86989B;
+    padding: 3px 8px 3px 0;
+    clear: both;
+    font-size: 0.8em;
+    text-align: right;
+}
+
+div.footer a {
+    color: #86989B;
+    text-decoration: underline;
+}
+
+div.pagination {
+    margin-top: 2em;
+    padding-top: 0.5em;
+    border-top: 1px solid black;
+    text-align: center;
+}
+
+div.sphinxsidebar ul.toc {
+    margin: 1em 0 1em 0;
+    padding: 0 0 0 0.5em;
+    list-style: none;
+}
+
+div.sphinxsidebar ul.toc li {
+    margin: 0.5em 0 0.5em 0;
+    font-size: 0.9em;
+    line-height: 130%;
+}
+
+div.sphinxsidebar ul.toc li p {
+    margin: 0;
+    padding: 0;
+}
+
+div.sphinxsidebar ul.toc ul {
+    margin: 0.2em 0 0.2em 0;
+    padding: 0 0 0 1.8em;
+}
+
+div.sphinxsidebar ul.toc ul li {
+    padding: 0;
+}
+
+div.admonition, div.warning {
+    font-size: 0.9em;
+    margin: 1em 0 0 0;
+    border: 1px solid #86989B;
+    background-color: #f7f7f7;
+}
+
+div.admonition p, div.warning p {
+    margin: 0.5em 1em 0.5em 1em;
+    padding: 0;
+}
+
+div.admonition pre, div.warning pre {
+    margin: 0.4em 1em 0.4em 1em;
+}
+
+div.admonition p.admonition-title,
+div.warning p.admonition-title {
+    margin: 0;
+    padding: 0.1em 0 0.1em 0.5em;
+    color: white;
+    border-bottom: 1px solid #86989B;
+    font-weight: bold;
+    background-color: #AFC1C4;
+}
+
+div.warning {
+    border: 1px solid #940000;
+}
+
+div.warning p.admonition-title {
+    background-color: #CF0000;
+    border-bottom-color: #940000;
+}
+
+div.admonition ul, div.admonition ol,
+div.warning ul, div.warning ol {
+    margin: 0.1em 0.5em 0.5em 3em;
+    padding: 0;
+}
+
+div.versioninfo {
+    margin: 1em 0 0 0;
+    border: 1px solid #ccc;
+    background-color: #DDEAF0;
+    padding: 8px;
+    line-height: 1.3em;
+    font-size: 0.9em;
+}
+
+
+a.headerlink {
+    color: #c60f0f!important;
+    font-size: 1em;
+    margin-left: 6px;
+    padding: 0 4px 0 4px;
+    text-decoration: none!important;
+    visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+    visibility: visible;
+}
+
+a.headerlink:hover {
+    background-color: #ccc;
+    color: white!important;
+}
+
+table.indextable td {
+    text-align: left;
+    vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+    margin-top: 0;
+    margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+    height: 10px;
+}
+
+table.indextable tr.cap {
+    margin-top: 10px;
+    background-color: #f2f2f2;
+}
+
+img.toggler {
+    margin-right: 3px;
+    margin-top: 3px;
+    cursor: pointer;
+}
+
+img.inheritance {
+    border: 0px
+}
+
+form.pfform {
+    margin: 10px 0 20px 0;
+}
+
+table.contentstable {
+    width: 90%;
+}
+
+table.contentstable p.biglink {
+    line-height: 150%;
+}
+
+a.biglink {
+    font-size: 1.3em;
+}
+
+span.linkdescr {
+    font-style: italic;
+    padding-top: 5px;
+    font-size: 90%;
+}
+
+ul.search {
+    margin: 10px 0 0 20px;
+    padding: 0;
+}
+
+ul.search li {
+    padding: 5px 0 5px 20px;
+    background-image: url(file.png);
+    background-repeat: no-repeat;
+    background-position: 0 7px;
+}
+
+ul.search li a {
+    font-weight: bold;
+}
+
+ul.search li div.context {
+    color: #888;
+    margin: 2px 0 0 30px;
+    text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+    font-weight: bold;
+}

sdoc/_templates/layout.html

+{% extends "!layout.html" %}
+
+
+{% block rootrellink %}
+        <li><a href="{{ pathto('index') }}">home</a>|&nbsp;</li>
+        <li><a href="{{ pathto('search') }}">search</a>|&nbsp;</li>
+{% endblock %}
+
+
+{% block relbar1 %}
+
+<!--
+<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
+<a href="{{ pathto('index') }}">Evolution</a>
+</div>
+-->
+{{ super() }}
+{% endblock %}
+
+{# put the sidebar before the body #}
+{% block sidebar1 %}{{ sidebar() }}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+
+# -*- coding: utf-8 -*-
+#
+# Mercurial Changeset Evolution documentation build configuration file, created by
+# sphinx-quickstart on Fri Aug 26 12:23:28 2011.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.todo']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.t'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Changeset Evolution for Mercurial'
+copyright = u'2011, Peter Arrenbrecht, Pierre-Yves David, Idan Kamara'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'MercurialChangesetEvolutiondoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'MercurialChangesetEvolution.tex', u'Changeset Evolution for Mercurial',
+   u'Peter Arrenbrecht, Pierre-Yves David, Idan Kamara', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'mercurialchangesetevolution', u'Changeset Evolution for Mercurial',
+     [u'Peter Arrenbrecht, Pierre-Yves David, Idan Kamara'], 1)
+]
+.. Mercurial Changeset Evolution documentation master file, created by
+   sphinx-quickstart on Fri Aug 26 12:23:28 2011.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Changeset Evolution for Mercurial
+=================================
+
+*Changeset evolution* (or just *evolution*) lets developers modify existing changesets in a controlled and collaborative fashion. It attempts to take the best of *mq* and *pbranch*.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 3
+
+   intro.t
+   test-doc-config.t
+   test-doc-solo.t
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`search`
+
+
+.. -*-restructuredtext-*-
+
+==========
+Background
+==========
+
+Key Points
+
+* Changesets are regular Mercurial changesets, much like with applied mq patches, and unlike pbranch's inter-branch diffs.
+* Changes to changesets are tracked, somewhat like with pbranch or versioned mq.
+* Evolution integrates with bookmarks to name particular patches. This is like mq's patch names, or pbranch's branch names.
+* Conflict resolution relies fully on Mercurial's merge and rebase mechanisms, much as with pbranch. This applies both to conflicts when you're rebasing your own changesets, as well as when merging diverging updates to the same changeset by multiple developers.
+* Changesets can transition seamlessly from a tentative to a frozen state (for instance when accepted upstream), much like with mq, and notably different from pbranch.
+* No history is ever rewritten (except optionally during garbage collection). Instead, we simply hide old versions of changesets (by default). This is like git's reflog.
+
+Implementation Notes
+
+* Changesets are *replaced* by newer versions. Older versions are then by default *hidden* from `hg log` etc.
+* Prior to being replaced, changesets are *updated* by descendant changesets. The change descriptions of the *updating* changesets serve as the changelog for the evolution of a specific changeset.
+* Update changesets ensure we always commit first, and only then start rewiring things. This should make things robust and interruptible (when merge conflicts arise, for instance).
+* Older changesets could be garbage-collected eventually.
+* Information about updates and replacements is kept in ``.hg/evolution``. This information would have to travel between repos via pushkey (so it is garbage-collectable).
+
+
+================
+Quick Impression
+================
+
+`hg amend`
+  Used to modify a single changeset. Writes a changelog message describing the update, and can also modify the changelog message of the updated changeset. Under the hood, it commits the pending working copy changes as an update to the working copy parent, then replaces both by a changeset combining the two. Can also be used when the update has already been committed manually.
+
+`hg elog`
+  Shows the history of a changeset's evolution. This is just the log of all update changesets which are replaced by this changeset (transitively).
+
+`hg evolve`
+  "Rebases" child changesets when some of their parent changesets have been modified. Under the hood, it merges updates to parent changesets into a child changeset as an update of the child, then replaces the merge with a combined version of the child and the merge. Can do this for multiple child changesets in sequence.
+
+
+

sdoc/test-doc-config.rst

+../tests/test-doc-config.rst

sdoc/test-doc-config.t

+../tests/test-doc-config.t

sdoc/test-doc-solo.t

+../tests/test-doc-solo.t
+cat >$HGRCPATH <<-eof
+[extensions]
+graphlog =
+evolution = $(dirname $TESTDIR)/hgext/evolution.py
+
+[defaults]
+commit = --date '0 0' --user john
+amend = --date '0 0' --user john
+evolve = --date '0 0' --user john
+
+[diff]
+git = 1
+unified = 0
+
+[ui]
+username = john
+logtemplate = "{rev}\t{bookmarks}: {desc|firstline} - {author|user}\n"
+merge = internal:merge
+editor = cat
+eof
+

tests/test-amend-twice.t

+  $ . $TESTDIR/config.sh
+
+Setup:
+
+  $ hg init quick
+  $ cd quick
+
+  $ echo Base >base
+  $ hg add base
+  $ hg ci -m "add base"
+
+  $ hg book patchA
+  $ echo A >a
+  $ hg add a
+  $ hg ci -m "add a"
+
+  $ hg book patchB
+  $ echo B >b
+  $ hg add b
+  $ hg ci -m "add b"
+
+  $ hg book patchC
+  $ echo C >c
+  $ hg add c
+  $ hg ci -m "add c"
+
+
+h2. Amend Twice
+
+  $ hg up patchB
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo Foo >base
+  $ hg amend -n "modified base in patchB" -u am1
+  $ echo Bar >base
+  $ hg amend -n "modified base in patchB again" -u am2
+
+  $ hg evolve patchC -u ev
+  rebasing rev 3 onto 5
+  updating to rev 3
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging with rev 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  committing new version
+  rebasing rev 9 onto 7
+  updating to rev 9
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging with rev 6
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  committing new version
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg glog -r 'visible()'
+  @  11	patchC: add c - ev
+  |
+  o  7	patchB: add b - am2
+  |
+  o  1	patchA: add a - test
+  |
+  o  0	: add base - test
+  
+
+  $ hg glog
+  @  11	patchC: add c - ev
+  |
+  | o    10	: rebasing 4a78fda265621d69bec2712ad201b465b1f73152 on 7431de2656131ccf4db046f7b3f8dda7a06c5578 - ev
+  | |\
+  | | o  9	: add c - ev
+  | | |
+  | | | o    8	: rebasing 3d236828763767749a028785c91365dac9585b5f on 1af41d2f19a146a9be1a0d5f252613be0461d714 - ev
+  | | | |\
+  o | | | |  7	patchB: add b - am2
+  | | | | |
+  | o | | |  6	: modified base in patchB again - am2
+  | |/ / /
+  | o / /  5	: add b - am1
+  |/ / /
+  | | o  4	: modified base in patchB - am1
+  | | |
+  | o |  3	: add c - test
+  | |/
+  | o  2	: add b - test
+  |/
+  o  1	patchA: add a - test
+  |
+  o  0	: add base - test
+  
+

tests/test-diverge.t

+
+h1. Quick Test
+
+Setup:
+
+	$ hg init quick
+	$ cd quick
+
+	$ echo Base >base
+	$ hg add base
+	$ hg ci -m "add base"
+
+	$ hg book patchA
+	$ echo A >a
+	$ hg add a
+	$ hg ci -m "add a"
+
+	$ hg book patchB
+	$ echo B >b
+	$ hg add b
+	$ hg ci -m "add b"
+
+	$ hg book patchC
+	$ echo C >c
+	$ hg add c
+	$ hg ci -m "add c"
+
+	$ cd ..
+
+
+h2. Merge Conflict
+
+One does:
+
+	$ hg clone quick merge-conf
+	updating to branch default
+	4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	$ cd merge-conf
+
+	$ hg up patchA
+	0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+	$ echo Foo >base
+	$ hg amend -n "modified base in patchA" -u one
+
+	$ hg evolve patchB -u one
+	rebasing rev 2 onto 5
+	2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	(branch merge, don't forget to commit)
+	0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	$ hg evolve patchC -u one
+	rebasing rev 3 onto 7
+	2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	(branch merge, don't forget to commit)
+	0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+	$ cd ..
+
+Other does:
+
+	$ hg clone quick merge-conf-2
+	updating to branch default
+	4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	$ cd merge-conf-2
+
+	$ hg up patchB
+	0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+	$ echo Bar >base
+	$ hg amend -n "modified base in patchB concurrently" -u two
+
+	$ hg evolve patchC -u two
+	rebasing rev 3 onto 5
+	2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+	(branch merge, don't forget to commit)
+	0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+One does:
+
+	$ cd ../merge-conf
+	$ hg pull ../merge-conf-2
+	pulling from ../merge-conf-2
+	searching for changes
+	adding changesets
+	adding manifests
+	adding file changes
+	added 4 changesets with 1 changes to 1 files (+2 heads)
+	not updating divergent bookmark patchB
+	not updating divergent bookmark patchC
+	(run 'hg heads .' to see heads, 'hg merge' to merge)
+
+	$ hg glog
+	o  13	: add c - john
+	|
+	| o    12	: rebasing d132d06ed1133bbcfce6bd567d03b6ff1d6bba39 on 6ac8ba1f8f985a11c0a11123b76d2c4fe2c0bed9 - john
+	| |\
+	o | |  11	: add b - john
+	| | |
+	| | o  10	: modified base in patchB concurrently - john
+	| | |
+	| | | @  9	patchC: add c - john
+	| | | |
+	| +-----o  8	: rebasing d132d06ed1133bbcfce6bd567d03b6ff1d6bba39 on e9f77eb67fbb4b16e3935bbe8bdaad73b7c84681 - john
+	| | | | |
+	| | | o |  7	patchB: add b - john
+	| | | | |
+	| | +---o  6	: rebasing 0f61627a69fea1ca7386f03e0ee33878030f0458 on a0a166259d4a714b845eaec7852550f28f7c0529 - john
+	| | | | |
+	| | | o |  5	patchA: add a - john
+	| | | | |
+	+-------o  4	: modified base in patchA - john
+	| | | |
+	| o | |  3	: add c - john
+	| |/ /
+	| o /  2	: add b - john
+	|/ /
+	o /  1	: add a - john
+	|/
+	o  0	: add base - john
+

tests/test-doc-config.t

+.. -*-restructuredtext-*-
+
+=============
+Configuration
+=============
+
+To use evolution, you need to enable it as a Mercurial extension in your ``hgrc`` file. It depends on the graphlog extension, so you should have (and probably enable) the latter as well::
+
+  $ cat >$HGRCPATH <<-eof
+  > [extensions]
+  > graphlog =
+  > evolution = $(dirname $TESTDIR)/hgext/evolution.py
+  > eof
+
+To verify it worked, call up the help::
+
+  $ hg help evolution
+  evolution extension - manages updates to changesets as versions thereof (an alternative to mq)
+  
+  For more information:
+  http://www.selenic.com/mercurial/wiki/index.cgi/ChangesetEvolution
+  
+  list of commands:
+  
+   amend     combine a changeset with updates and replace it with a new one
+   elog      show evolution history of a particular changeset
+   estatus   print status of current (or given) changesets
+   evolve    rebase changesets on newer versions of their parents
+  
+  use "hg -v help evolution" to show builtin aliases and global options
+

tests/test-doc-solo.t

+.. -*-restructuredtext-*-
+
+======================
+Single Developer Usage
+======================
+
+This tutorial shows how to use evolution to replace the basics of *mq*. We therefore talk about *patches* here, even though, with evolution, they are always regular Mercurial changesets.
+
+  $ . $TESTDIR/config.sh
+
+
+TODO
+====
+
+Single user
+
+* Merge conflict handling
+* Amend multiple times in a row, then evolve
+* Pull changes up (move some diffs into parent csets)
+* Push changes down (move some diffs into child csets and back them out of the parents)
+* Fold patches
+* Split patches
+* Shuffle patches
+* Freeze patches
+* Disable patches (mq's guards)
+
+Collaboration
+
+* Merge divergent updates to patches (probably the same as multiple, divergent amends by a single user)
+* How to use pushkey to distribute information in .hg/evolution/
+
+
+Creating And Updating Patches
+=============================
+
+
+Setup the Base Repo
+-------------------
+
+We start with a plain base repo::
+
+  $ hg init main; cd main
+  $ cat >main-file-1 <<-eof
+  > One
+  > 
+  > Two
+  > 
+  > Three
+  > eof
+  $ echo Two >main-file-2
+  $ hg add
+  adding main-file-1
+  adding main-file-2
+  $ hg commit --message base
+  $ cd ..
+
+and clone this into a new repo where we do our work::
+
+  $ hg clone main work
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd work
+
+
+Create First Patch
+------------------
+
+To begin with, we just do the changes that will be the initial version of the patch::
+
+  $ echo One >file-from-A
+  $ sed -i main-file-1 -e s/One/Eins/
+  $ hg add file-from-A
+
+So this is what we would like our patch to be::
+
+  $ hg diff
+  diff --git a/file-from-A b/file-from-A
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-A
+  @@ -0,0 +1,1 @@
+  +One
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -1,1 +1,1 @@
+  -One
+  +Eins
+
+To commit it we just - commit it::
+
+  $ hg commit --message "a nifty patch"
+
+and place a bookmark so we can easily refer to it again (which we could have done before the commit)::
+
+  $ hg book patchA
+
+
+Create Second Patch
+-------------------
+
+Let's do this again for the second patch::
+
+  $ echo Two >file-from-B
+  $ sed -i main-file-1 -e s/Two/Zwie/
+  $ hg add file-from-B
+
+Before committing, however, we need to switch to a new bookmark for the second patch. Otherwise we would inadvertently move the bookmark for our first patch. It is therefore advisable to always set the bookmark before committing::
+
+  $ hg book patchB
+  $ hg commit --message "another patch"
+
+So here we are::
+
+  $ hg book
+     patchA                    1:31a027017c05
+   * patchB                    2:27cbda7e13f7
+
+
+Fix The Second Patch
+--------------------
+
+There's a typo in patchB. We spelled *Zwie* instead of *Zwei*::
+
+  $ hg diff --change tip | grep -F Zwie
+  +Zwie
+
+Fixing this is very easy. Just change::
+
+  $ sed -i main-file-1 -e s/Zwie/Zwei/
+
+and **amend**::
+
+  $ hg amend --note "fix spelling of Zwei"
+
+The `--note` is our commit message for the *update* only. So its only purpose is to document the evolution of the patch. If we use `--message` with `amend`, it replaces the commit message of the patch itself.
+
+This results in a new single changeset for our amended patch, and the old changeset plus the updating changeset are hidden from view by default::
+
+  $ hg log
+  4	patchB: another patch - john
+  1	patchA: a nifty patch - john
+  0	: base - john
+
+The hidden patches are still shown by `glog` by default (this should be fixed)::
+
+  $ hg glog # --hidden
+  @  4	patchB: another patch - john
+  |
+  | o  3	: fix spelling of Zwei - john
+  | |
+  | o  2	: another patch - john
+  |/
+  o  1	patchA: a nifty patch - john
+  |
+  o  0	: base - john
+  
+
+A quick fix is::
+
+  $ hg glog -r 'visible()'
+  @  4	patchB: another patch - john
+  |
+  o  1	patchA: a nifty patch - john
+  |
+  o  0	: base - john
+  
+
+And here is the new patch in full::
+
+  $ hg log --patch --rev tip
+  4	patchB: another patch - john
+  diff --git a/file-from-B b/file-from-B
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-B
+  @@ -0,0 +1,1 @@
+  +Two
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -3,1 +3,1 @@
+  -Two
+  +Zwei
+  
+
+
+**********
+`hg amend`
+**********
+
+Behind the scenes, Mercurial does the following. First, it commits the change right away. This records the note and makes sure failures in subsequent steps won't cause irreparable loss of data. Then it updates back to the parent of the original version of the patch and applies the amended patch as a new changeset, updates the bookmark, and sets the working copy parent to this new changeset. This can be seen here::
+
+  $ hg parents
+  4	patchB: another patch - john
+
+  $ hg bookmarks
+     patchA                    1:31a027017c05
+   * patchB                    4:c61663dae6ca
+
+  $ hg glog --patch # --hidden
+  @  4	patchB: another patch - john
+  |  diff --git a/file-from-B b/file-from-B
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/file-from-B
+  |  @@ -0,0 +1,1 @@
+  |  +Two
+  |  diff --git a/main-file-1 b/main-file-1
+  |  --- a/main-file-1
+  |  +++ b/main-file-1
+  |  @@ -3,1 +3,1 @@
+  |  -Two
+  |  +Zwei
+  |
+  | o  3	: fix spelling of Zwei - john
+  | |  diff --git a/main-file-1 b/main-file-1
+  | |  --- a/main-file-1
+  | |  +++ b/main-file-1
+  | |  @@ -3,1 +3,1 @@
+  | |  -Zwie
+  | |  +Zwei
+  | |
+  | o  2	: another patch - john
+  |/   diff --git a/file-from-B b/file-from-B
+  |    new file mode 100644
+  |    --- /dev/null
+  |    +++ b/file-from-B
+  |    @@ -0,0 +1,1 @@
+  |    +Two
+  |    diff --git a/main-file-1 b/main-file-1
+  |    --- a/main-file-1
+  |    +++ b/main-file-1
+  |    @@ -3,1 +3,1 @@
+  |    -Two
+  |    +Zwie
+  |
+  o  1	patchA: a nifty patch - john
+  |  diff --git a/file-from-A b/file-from-A
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/file-from-A
+  |  @@ -0,0 +1,1 @@
+  |  +One
+  |  diff --git a/main-file-1 b/main-file-1
+  |  --- a/main-file-1
+  |  +++ b/main-file-1
+  |  @@ -1,1 +1,1 @@
+  |  -One
+  |  +Eins
+  |
+  o  0	: base - john
+     diff --git a/main-file-1 b/main-file-1
+     new file mode 100644
+     --- /dev/null
+     +++ b/main-file-1
+     @@ -0,0 +1,5 @@
+     +One
+     +
+     +Two
+     +
+     +Three
+     diff --git a/main-file-2 b/main-file-2
+     new file mode 100644
+     --- /dev/null
+     +++ b/main-file-2
+     @@ -0,0 +1,1 @@
+     +Two
+  
+
+Finally, it flags the old csets as hidden (to log etc.) and records the evolution metadata. This is kept within your ``.hg/`` folder::
+
+  $ cat .hg/evolution
+  6267254365ec7dd0713afc27c8bf0ce8b01067b0
+   U 27cbda7e13f7f83f27664320807e65f50a230392
+  c61663dae6ca5e66751b16255a515eef55532954
+   R 27cbda7e13f7f83f27664320807e65f50a230392
+   S 6267254365ec7dd0713afc27c8bf0ce8b01067b0
+
+  $ cat .hg/hiddenrevs
+  27cbda7e13f7f83f27664320807e65f50a230392
+  6267254365ec7dd0713afc27c8bf0ce8b01067b0
+
+Mercurial records the fact that the amending changeset *updates* the old changeset, and the new sibling changeset in turn *replaces* the old changeset and *subsumes* the amending changeset. This information will be used later to detect and reconcile concurrent updates. It's also useful to show diffs of patch evolution.
+
+
+View Patch History
+------------------
+
+To view the patch's history, we use a special command::
+
+  $ hg elog
+  3	: fix spelling of Zwei - john
+
+This is simply the log of all update changesets created and then hidden by `hg amend`. It's straightforward to also show changes with this::
+
+  $ hg elog --patch
+  3	: fix spelling of Zwei - john
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -3,1 +3,1 @@
+  -Zwie
+  +Zwei
+  
+
+
+*******
+hg elog
+*******
+
+Mercurial basically follows the data in ``.hg/evolution`` for all source changesets (which defaults to your working copy parent). It shows all subsumed changesets and follows all replaced changesets.
+
+For graphlog, Mercurial would have to supply a custom graph driver that uses patch history data instead of changelog ancestry (not shown here).
+
+
+Rebasing Later Patches
+======================
+
+
+Create Third Patch
+------------------
+
+Let's quickly create another patch before we start updating earlier patches::
+
+  $ echo Three >file-from-C
+  $ sed -i main-file-1 -e s/Three/Drei/
+  $ hg add file-from-C
+  $ hg book patchC
+  $ hg commit --message "yet another patch"
+
+
+Modify An Earlier Patch
+-----------------------
+
+We can go back to an earlier patch to amend it. Since each patch is bookmarked, we just update to the desired bookmark::
+
+  $ hg update patchA
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+and make our modifications there::
+
+  $ echo Later >>file-from-A
+
+Ideally now, we would say::
+
+  $ #hg amend --note "second try in A"
+
+But let's say we forgot and instead did::
+
+  $ hg commit --message "second try in A"
+  created new head
+
+This is easy to fix::
+
+  $ hg amend --change .
+
+The above is actually shorthand for::
+
+  $ #hg amend --change 'p1(p1())'
+
+which means we should subsume all changesets between our working copy's parent and it's parent's parent as updates.
+
+The result is::
+
+  $ hg glog -r 'visible()'
+  @  7	patchA: a nifty patch - john
+  |
+  | o  5	patchC: yet another patch - john
+  | |
+  | o  4	patchB: another patch - john
+  |/
+  o  0	: base - john
+  
+
+where it is worth noting that patchB now appears to be a child of 0, while actually it is a child of the old version of patchA, which is now hidden by default. To improve this, we might want to add elision nodes to graphlog. The real situation can be seen here::
+
+  $ hg glog # --hidden
+  @  7	patchA: a nifty patch - john
+  |
+  | o  6	: second try in A - john
+  | |
+  | | o  5	patchC: yet another patch - john
+  | | |
+  | | o  4	patchB: another patch - john
+  | |/
+  | | o  3	: fix spelling of Zwei - john
+  | | |
+  | | o  2	: another patch - john
+  | |/
+  | o  1	: a nifty patch - john
+  |/
+  o  0	: base - john
+  
+
+Rebase The Later Patches
+------------------------
+
+The later patches `patchB` and `patchC` are now based on a replaced version of `patchA`. This is not fixed until we actually update to them. To make it easier to follow, we'll do it one patch at a time. First, though, I clone the repo so we can see what happens when do both in one go::
+
+  $ hg clone . ../evolve-in-one-go
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cp .hg/hiddenrevs .hg/evolution ../evolve-in-one-go/.hg/
+
+So let's do `patchB`::
+
+  $ hg update patchB
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  WARNING: rev 4 needs rebase on rev 7, which replaces rev 1
+  use 'hg evolve'
+
+The information for the above warning is obtained from the metadata contained in ``.hg/evolution``, which tells Mercurial that the current parent of this changeset has been replaced by rev 7.
+
+There are other such warnings, as can be seen here::
+
+  $ hg update 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  WARNING: rev 2 has been replaced by rev 4
+
+  $ hg update 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  WARNING: rev 3 is an update of rev 2, which was replaced by rev 4
+
+But let's get back to `patchB`::
+
+  $ hg update patchB
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  WARNING: rev 4 needs rebase on rev 7, which replaces rev 1
+  use 'hg evolve'
+
+and do what we're told::
+
+  $ hg evolve
+  rebasing rev 4 onto 7
+  updating to rev 4
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging with rev 6
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  committing new version
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+The result is::
+
+  $ hg glog -r 'visible()'
+  @  9	patchB: another patch - john
+  |
+  o  7	patchA: a nifty patch - john
+  |
+  | o  5	patchC: yet another patch - john
+  |/
+  o  0	: base - john
+  
+
+With full details::
+
+  $ hg glog # --hidden
+  @  9	patchB: another patch - john
+  |
+  | o    8	: rebasing c61663dae6ca5e66751b16255a515eef55532954 on f1cb1a5426300904c5373a775343697e3b28d0ed - john
+  | |\
+  o | |  7	patchA: a nifty patch - john
+  | | |
+  | | o  6	: second try in A - john
+  | | |
+  | +---o  5	patchC: yet another patch - john
+  | | |
+  | o |  4	: another patch - john
+  | |/
+  | | o  3	: fix spelling of Zwei - john
+  | | |
+  | | o  2	: another patch - john
+  | |/
+  | o  1	: a nifty patch - john
+  |/
+  o  0	: base - john
+  
+
+And the patch data is::
+
+  $ hg log --patch --rev patchB
+  9	patchB: another patch - john
+  diff --git a/file-from-B b/file-from-B
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-B
+  @@ -0,0 +1,1 @@
+  +Two
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -3,1 +3,1 @@
+  -Two
+  +Zwei
+  
+
+The same happens if we now update to `patchC`::
+
+  $ hg update patchC
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  WARNING: rev 5 needs rebase on rev 9, which replaces rev 4
+  use 'hg evolve'
+
+  $ hg evolve
+  rebasing rev 5 onto 9
+  updating to rev 5
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging with rev 8
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  committing new version
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg glog -r 'visible()'
+  @  11	patchC: yet another patch - john
+  |
+  o  9	patchB: another patch - john
+  |
+  o  7	patchA: a nifty patch - john
+  |
+  o  0	: base - john
+  
+
+  $ hg glog # --hidden
+  @  11	patchC: yet another patch - john
+  |
+  | o    10	: rebasing f104d3a2a305f7513b0bd0e6bb430ce451da2739 on 219017dabfc267a50d727d09b347a784a8628663 - john
+  | |\
+  o | |  9	patchB: another patch - john
+  | | |
+  | | o    8	: rebasing c61663dae6ca5e66751b16255a515eef55532954 on f1cb1a5426300904c5373a775343697e3b28d0ed - john
+  | | |\
+  o | | |  7	patchA: a nifty patch - john
+  | | | |
+  | | | o  6	: second try in A - john
+  | | | |
+  | o | |  5	: yet another patch - john
+  | |/ /
+  | o /  4	: another patch - john
+  | |/
+  | | o  3	: fix spelling of Zwei - john
+  | | |
+  | | o  2	: another patch - john
+  | |/
+  | o  1	: a nifty patch - john
+  |/
+  o  0	: base - john
+  
+
+  $ hg log --rev patchC --patch
+  11	patchC: yet another patch - john
+  diff --git a/file-from-C b/file-from-C
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-C
+  @@ -0,0 +1,1 @@
+  +Three
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -5,1 +5,1 @@
+  -Three
+  +Drei
+  
+
+We can look at how `patchC` evolved::
+
+  $ hg elog
+  10	: rebasing f104d3a2a305f7513b0bd0e6bb430ce451da2739 on 219017dabfc267a50d727d09b347a784a8628663 - john
+
+With changes::
+
+  $ hg elog --patch
+  10	: rebasing f104d3a2a305f7513b0bd0e6bb430ce451da2739 on 219017dabfc267a50d727d09b347a784a8628663 - john
+  diff --git a/file-from-A b/file-from-A
+  --- a/file-from-A
+  +++ b/file-from-A
+  @@ -2,0 +2,1 @@
+  +Later
+  
+
+Note that this actually shows a change that does *not* reflect something pertaining to `patchC` as such. So we might want to have a version of `hg elog` which shows only csets that aren't auto-merges.
+
+
+Rebase All Patches In One Go
+----------------------------
+
+Let's now switch to the repo I saved and test evolving all of the patches in one go::
+
+  $ cd ../evolve-in-one-go
+
+  $ hg update patchC
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  WARNING: rev 4 needs rebase on rev 7, which replaces rev 1
+  use 'hg evolve'
+
+  $ hg evolve
+  rebasing rev 4 onto 7
+  updating to rev 4
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  merging with rev 6
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  committing new version
+  rebasing rev 5 onto 9
+  updating to rev 5
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merging with rev 8
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  committing new version
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Again, the details::
+
+  $ hg glog
+  @  11	patchC: yet another patch - john
+  |
+  | o    10	: rebasing f104d3a2a305f7513b0bd0e6bb430ce451da2739 on 219017dabfc267a50d727d09b347a784a8628663 - john
+  | |\
+  o | |  9	patchB: another patch - john
+  | | |
+  | | o    8	: rebasing c61663dae6ca5e66751b16255a515eef55532954 on f1cb1a5426300904c5373a775343697e3b28d0ed - john
+  | | |\
+  o | | |  7	patchA: a nifty patch - john
+  | | | |
+  | | | o  6	: second try in A - john
+  | | | |
+  | o | |  5	: yet another patch - john
+  | |/ /
+  | o /  4	: another patch - john
+  | |/
+  | | o  3	: fix spelling of Zwei - john
+  | | |
+  | | o  2	: another patch - john
+  | |/
+  | o  1	: a nifty patch - john
+  |/
+  o  0	: base - john
+  
+
+And to verify the patch data::
+
+  $ hg log --patch
+  11	patchC: yet another patch - john
+  diff --git a/file-from-C b/file-from-C
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-C
+  @@ -0,0 +1,1 @@
+  +Three
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -5,1 +5,1 @@
+  -Three
+  +Drei
+  
+  9	patchB: another patch - john
+  diff --git a/file-from-B b/file-from-B
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-B
+  @@ -0,0 +1,1 @@
+  +Two
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -3,1 +3,1 @@
+  -Two
+  +Zwei
+  
+  7	patchA: a nifty patch - john
+  diff --git a/file-from-A b/file-from-A
+  new file mode 100644
+  --- /dev/null
+  +++ b/file-from-A
+  @@ -0,0 +1,2 @@
+  +One
+  +Later
+  diff --git a/main-file-1 b/main-file-1
+  --- a/main-file-1
+  +++ b/main-file-1
+  @@ -1,1 +1,1 @@
+  -One
+  +Eins
+  
+  0	: base - john
+  diff --git a/main-file-1 b/main-file-1
+  new file mode 100644
+  --- /dev/null
+  +++ b/main-file-1
+  @@ -0,0 +1,5 @@
+  +One
+  +
+  +Two
+  +
+  +Three
+  diff --git a/main-file-2 b/main-file-2
+  new file mode 100644
+  --- /dev/null
+  +++ b/main-file-2
+  @@ -0,0 +1,1 @@
+  +Two
+  
+
+All good, so let's switch back::
+
+  $ cd ../work
+
+
+Moving Changes Between Patches
+==============================
+
+Sometimes you realize only later that a particular change within a patch should actually be part of another patch. This happens in two directions: moving a change to a parent, or to a child.
+
+
+Moving a Change to a Parent Patch
+---------------------------------
+
+Moving to a parent patch is the easier case. In essence, you backport the changes to the parent as an amendment, and then evolve them forward. But first, let's do the change to be backported::
+
+	$ hg up patchB
+	$ sed -i main-file-1 -e s/Eins/EinsB/ -e s/Zwei/ZweiB/
+	$ hg amend --note "Change to be backported"
+
+We want to backport only the change from "Eins" to "EinsB", though, so we need to somehow select it.
+

tut/build.sh

-#! /bin/bash
-
-homedir=$HOME
-rootdir=`pwd`
-workdir=/tmp/hg-tut-$USER
-
-export HGPATH=$rootdir/..
-export HGRCPATH=$workdir/.hgrc
-export HOME=$workdir
-
-rm -rf $workdir
-rm -rf build/
-mkdir -p $workdir
-mkdir -p build/ref/
-cp -r src build/src
-
-for f in $@; do
-	mkdir -p build/bash/${f%/*}
-	mkdir -p build/ref/${f%/*}
-	mkdir -p build/src/${f%/*}
-	( cd $workdir; python $rootdir/docbash.py $rootdir/{src,build/src,build/ref}/$f.rextile $rootdir/build/bash/$f.sh )
-	diff  \
-		-I "[	 ]\+Message-Id: .*$" \
-		-I "[	 ]\+In-Reply-To: .*$" \
-		-I "[	 ]\+References: .*$" \
-		-I "[	 ]\+User-Agent: .*$" \
-		-I "[	 ]\+Date: .*$" \
-		{src,build/ref}/$f.rextile
-	if [ "$?" -ne "0" ]; then
-		dis meld {src,build/ref}/$f.rextile
-	fi
-done
-
-mkdir -p build/doc/
-( cd build/src; rextile )
-find build/doc/ -name "*.htm" | xargs sed -e "s/^_//" -i
-cp -t build/doc/ src/*.css
-

tut/buildall.sh

-#! /bin/bash
-
-./build.sh config simple
-

tut/docbash.py

-#! /usr/bin/env python
-
-from __future__ import with_statement
-from subprocess import Popen, PIPE, STDOUT
-import sys, re, cgi
-
-def unformat(line):
-    res = line.strip("\n")
-    if res.startswith("\t"):
-        res = res[1:]
-    return res.strip(" $")
-
-class Runner:
-
-    def __init__(self):
-        self.HGCALL = re.compile("(^|; )hg ")
-        self.shell = Popen("/bin/bash", stdin=PIPE, stdout=PIPE, stderr=STDOUT)
-
-    def run(self, cmdlines, script):
-
-        def localhg(cmd):
-            (res, _subs) = self.HGCALL.subn('$HGPATH/hg ', cmd)
-            return res
-        
-        cmds = [l.strip("\n") for l in cmdlines]
-        cmds = [localhg(l) for l in cmds]
-
-        for l in cmds:
-            script.write("%s\n" % l)
-
-        cmd = "\n".join(cmds) + "\necho\necho ,,,,\n"
-        self.shell.stdin.write(cmd)
-        self.shell.stdin.flush()
-        outlines = []
-        stdout = self.shell.stdout
-        l = None
-        while True:
-            l = stdout.readline()
-            if l == ",,,,\n": break
-            outlines.append(l.rstrip())
-        while outlines and not outlines[-1]:
-            del outlines[-1]
-        return ["%s\n" % l for l in outlines]
-    
-    def close(self):
-        self.shell.communicate("exit\n")
-
-def run(srcname, tgtname, actname, scriptname):
-    runner = Runner()
-    with open(tgtname, "w") as tgt:
-        code = 0
-        input = 1
-        have = [False, False]
-        def startinput():
-            if not have[code]:
-                tgt.write('<notextile>\n<pre><code><span class="input">')
-                have[code] = True
-                have[input] = True
-            elif not have[input]:
-                tgt.write('</span><span class="input">')
-                have[input] = True
-        def startoutput():
-            tgt.write('</span><span class="output">')
-            have[input] = False
-        def stoptranscript():
-            if have[code]:
-                tgt.write('</span></code></pre>\n</notextile>\n')
-                have[:] = [False, False]
-        with open(actname, "w") as act:
-            with open(srcname) as src:
-                with open(scriptname, "w") as script:
-                    line = src.readline()
-                    while line:
-                        if line.startswith("\t$ "):