Commits

Bryan O'Sullivan committed 8366882

Fix up more formatting goop

Comments (0)

Files changed (15)

 
 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
 
-example-sources := \
+example-sources-by-name := \
 	backout \
 	bisect \
 	branching \
 	tour \
 	tour-merge-conflict
 
+example-sources := \
+	$(example-sources-by-name:%=examples/%) \
+	$(wildcard examples/ch*/*)
+
 obj-web := html
 obj-websup := html/support
 
 
 examples: $(example-prereqs) examples/.run
 
-examples/.run: $(example-sources:%=examples/%.run)
-	touch examples/.run
+examples/.run: $(example-sources)
+	cd examples && ./run-example
 
 examples/%.run: examples/% examples/run-example
-	cd examples && ./run-example $(notdir $<)
 
 clean:
 	-rm -rf dist html $(image-dot:%.dot=%.pdf) $(image-dot:%.dot=%.png) \

en/appB-mq-ref.xml

 
       <para>This command is shorthand for <command role="hg-cmd">hg
 	  commit --cwd .hg/patches</command>.</para>
-
-      <para>\subsection{<command
+    </sect2>
+    <sect2>
+	<title><command
 	  role="hg-ext-mq">qdelete</command>&emdash;delete a patch
 	from the <filename role="special">series</filename>
-	file}</para>
+	file}</title>
 
       <para>The <command role="hg-ext-mq">qdelete</command> command
 	removes the entry for a patch from the <filename

en/ch00-preface.xml

 
     <para>This book is licensed under the Open Publication License,
       and is produced entirely using Free Software tools.  It is
-      typeset with \LaTeX{}; illustrations are drawn and rendered with
+      typeset with DocBook XML.  Illustrations are drawn and rendered with
       <ulink url="http://www.inkscape.org/">Inkscape</ulink>.</para>
 
     <para>The complete source code for this book is published as a

en/ch06-collab.xml

 	<listitem><para>If you have a high tolerance for pain, you can
 	    use the Cygwin port of OpenSSH.</para>
 	</listitem></itemizedlist>
-      <para>In either case, you'll need to edit your \hgini\ file to
+      <para>In either case, you'll need to edit your <filename
+      role="special">hg.ini</filename> file to
 	tell Mercurial where to find the actual client command.  For
 	example, if you're using PuTTY, you'll need to use the
 	<command>plink</command> command as a command-line ssh
 	<para>  The path to <command>plink</command> shouldn't contain
 	  any whitespace characters, or Mercurial may not be able to
 	  run it correctly (so putting it in <filename
-	    class="directory">C:\\Program Files</filename> is probably
+	    class="directory">C:\Program Files</filename> is probably
 	  not a good idea).</para>
       </note>
 
 	your server, the next step is to ensure that Mercurial runs on
 	the server.  The following command should run
 	successfully:</para>
+
       <programlisting>ssh myserver hg version</programlisting>
+
       <para>If you see an error message instead of normal <command
 	  role="hg-cmd">hg version</command> output, this is usually
 	because you haven't installed Mercurial to <filename
       <para>Both <command>ssh</command> and <command>plink</command>
 	accept a <option role="cmd-opt-ssh">-C</option> option which
 	turns on compression.  You can easily edit your <filename
-	  role="special"> /.hgrc</filename>\ to enable compression for
+	  role="special">~/.hgrc</filename> to enable compression for
 	all of Mercurial's uses of the ssh protocol.</para>
       <programlisting>[ui]
 ssh = ssh -C</programlisting>
 	directory, from which they can serve up web pages.  A file
 	named <filename>foo</filename> in this directory will be
 	accessible at a URL of the form
-	<literal>http://www.example.com/\
-	  {</literal>username/foo}.</para>
+	<literal>http://www.example.com/username/foo</literal>.</para>
 
       <para>To get started, find the <filename
 	  role="special">hgweb.cgi</filename> script that should be
 
 	&ch06-apache-config.lst;
 
-	<programlisting>&lt;Directory /home/*/public_html&gt;
-	  AllowOverride FileInfo AuthConfig Limit Options MultiViews
-	  Indexes SymLinksIfOwnerMatch IncludesNoExec &lt;Limit GET
-	  POST OPTIONS&gt; Order allow,deny Allow from all
-	  &lt;/Limit&gt; &lt;LimitExcept GET POST OPTIONS&gt; Order
-	  deny,allow Deny from all &lt;/LimitExcept&gt;
-	  &lt;/Directory&gt;</programlisting>
 	<para>If you find a similar-looking
 	  <literal>Directory</literal> group in your Apache
 	  configuration, the directive to look at inside it is
 	  <literal>mod_userdir</literal>, both of which were disabled
 	  by default on my system.  I then added a few lines to the
 	  end of the config file, to configure these modules.</para>
-	<programlisting>userdir.path = "public_html" cgi.assign = (
-	  ".cgi" =&gt; "" )</programlisting>
+	<programlisting>userdir.path = "public_html"
+cgi.assign = (".cgi" =&gt; "" )</programlisting>
 	<para>With this done, <literal>lighttpd</literal> ran
 	  immediately for me.  If I had configured
 	  <literal>lighttpd</literal> before Apache, I'd almost
       <para>You'll need to copy this script into your <filename
 	  class="directory">public_html</filename> directory, and
 	ensure that it's executable.</para>
-      <programlisting>cp .../hgwebdir.cgi ~/public_html chmod 755
-	~/public_html ~/public_html/hgwebdir.cgi</programlisting>
+      <programlisting>cp .../hgwebdir.cgi ~/public_html
+chmod 755 ~/public_html ~/public_html/hgwebdir.cgi</programlisting>
       <para>With basic configuration out of the way, try to visit
 	<ulink url="http://myhostname/
 	  myuser/hgwebdir.cgi">http://myhostname/
 	publish <emphasis>every</emphasis> repository under the
 	directories you name.  The section should look like
 	this:</para>
-      <programlisting>[collections] /my/root =
-	/my/root</programlisting>
+      <programlisting>[collections]
+/my/root = /my/root</programlisting>
       <para>Mercurial interprets this by looking at the directory name
 	on the <emphasis>right</emphasis> hand side of the
 	<quote><literal>=</literal></quote> sign; finding repositories
 	  to publish a specific list of repositories.  To do so,
 	  create a <literal>paths</literal> section, with contents of
 	  the following form.</para>
-	<programlisting>[paths] repo1 = /my/path/to/some/repo repo2 =
-	  /some/path/to/another</programlisting>
+	<programlisting>[paths]
+repo1 = /my/path/to/some/repo
+repo2 = /some/path/to/another</programlisting>
 	<para>In this case, the virtual path (the component that will
 	  appear in a URL) is on the left hand side of each
 	  definition, while the path to the repository is on the
 	you'll need to add an <envar
 	  role="rc-item-web">allow_archive</envar> item to the
 	<literal role="rc-web">web</literal> section of your <filename
-	  role="special"> /.hgrc</filename>.</para>
+	  role="special">~/.hgrc</filename>.</para>
 
     </sect2>
     <sect2>
 	    <envar role="rc-item-web">allow_archive</envar> entry at
 	    all, this feature will be disabled.  Here is an example of
 	    how to enable all three supported formats.</para>
-	  <programlisting>[web] allow_archive = bz2 gz
-	    zip</programlisting>
+	  <programlisting>[web]
+allow_archive = bz2 gz zip</programlisting>
 	</listitem>
 	<listitem><para><envar role="rc-item-web">allowpull</envar>:
 	    Boolean.  Determines whether the web interface allows
 	    address of a person or mailing list.  It often makes sense
 	    to place this entry in a repository's own <filename
 	      role="special">.hg/hgrc</filename> file, but it can make
-	    sense to use in a global <filename role="special">
-	      /.hgrc</filename>\ if every repository has a single
-	    maintainer.</para>
+	    sense to use in a global <filename
+	      role="special">~/.hgrc</filename> if every repository
+	    has a single maintainer.</para>
 	</listitem>
 	<listitem><para><envar role="rc-item-web">maxchanges</envar>:
 	    Integer.  The default maximum number of changesets to
 	    <xref linkend="chap:template"/> for details.
 	    Here, you can see how to enable the
 	    <literal>gitweb</literal> style.</para>
-	  <programlisting>[web] style = gitweb</programlisting>
+	  <programlisting>[web]
+style = gitweb</programlisting>
 	</listitem>
 	<listitem><para><envar role="rc-item-web">templates</envar>:
 	    Path.  The directory in which to search for template
 	configuration items in a <literal role="rc-web">web</literal>
 	section of the <filename
 	  role="special">hgweb.config</filename> file instead of a
-	<filename role="special"> /.hgrc</filename>\ file, for
+	<filename role="special">~/.hgrc</filename> file, for
 	convenience.  These items are <envar
 	  role="rc-item-web">motd</envar> and <envar
 	  role="rc-item-web">style</envar>.</para>
 	<para>A few <literal role="rc-web">web</literal> configuration
 	  items ought to be placed in a repository's local <filename
 	    role="special">.hg/hgrc</filename>, rather than a user's
-	  or global <filename role="special">
-	    /.hgrc</filename>.</para>
+	  or global <filename role="special">~/.hgrc</filename>.</para>
 	<itemizedlist>
 	  <listitem><para><envar
 		role="rc-item-web">description</envar>: String.  A
 
 	<para>Some of the items in the <literal
 	    role="rc-web">web</literal> section of a <filename
-	    role="special"> /.hgrc</filename>\ file are only for use
+	    role="special">~/.hgrc</filename> file are only for use
 	  with the <command role="hg-cmd">hg serve</command>
 	  command.</para>
 	<itemizedlist>
 
       </sect3>
       <sect3>
-	<title>Choosing the right <filename role="special">
-	    /.hgrc</filename>\ file to add <literal
+	<title>Choosing the right <filename
+	    role="special">~/.hgrc</filename> file to add <literal
 	    role="rc-web">web</literal> items to</title>
 
 	<para>It is important to remember that a web server like
 	  under that user ID.</para>
 
 	<para>If you add <literal role="rc-web">web</literal> items to
-	  your own personal <filename role="special">
-	    /.hgrc</filename>\ file, CGI scripts won't read that
-	  <filename role="special"> /.hgrc</filename>\ file.  Those
+	  your own personal <filename role="special">~/.hgrc</filename> file, CGI scripts won't read that
+	  <filename role="special">~/.hgrc</filename> file.  Those
 	  settings will thus only affect the behaviour of the <command
 	    role="hg-cmd">hg serve</command> command when you run it.
 	  To cause CGI scripts to see your settings, either create a
-	  <filename role="special"> /.hgrc</filename>\ file in the
+	  <filename role="special">~/.hgrc</filename> file in the
 	  home directory of the user ID that runs your web server, or
 	  add those settings to a system-wide <filename
-	    role="special"> /.hgrc</filename>\ file.</para>
+	    role="special">~/.hgrc</filename> file.</para>
 
 
       </sect3>

en/ch08-branch.xml

       <quote>stable</quote> branch.  Such a hook might look like this
       inside the shared repo's <filename role="special">
 	/.hgrc</filename>.</para>
-    <programlisting>[hooks] pretxnchangegroup.branch = hg heads
-      --template '{branches} ' | grep mybranch</programlisting>
+    <programlisting>[hooks]
+pretxnchangegroup.branch = hg heads --template '{branches} ' | grep mybranch</programlisting>
 
   </sect1>
 </chapter>
       <para>In some cases, you may be exposed to hooks that you did
 	not install yourself.  If you work with Mercurial on an
 	unfamiliar system, Mercurial will run hooks defined in that
-	system's global <filename role="special"> /.hgrc</filename>\
+	system's global <filename role="special">~/.hgrc</filename>
 	file.
       </para>
 
       <para>In a corporate intranet, this is somewhat easier to
 	control, as you can for example provide a
 	<quote>standard</quote> installation of Mercurial on an NFS
-	filesystem, and use a site-wide <filename role="special">
-	  /.hgrc</filename>\ file to define hooks that all users will
+	filesystem, and use a site-wide <filename role="special">~/.hgrc</filename> file to define hooks that all users will
 	see.  However, this too has its limits; see below.
       </para>
 
       </para>
 
       <para>If you deploy a system- or site-wide <filename
-	  role="special"> /.hgrc</filename>\ file that defines some
+	  role="special">~/.hgrc</filename> file that defines some
 	hooks, you should thus understand that your users can disable
 	or override those hooks.
       </para>
 	want others to be able to work around.  For example, you may
 	have a requirement that every changeset must pass a rigorous
 	set of tests.  Defining this requirement via a hook in a
-	site-wide <filename role="special"> /.hgrc</filename>\ won't
+	site-wide <filename role="special">~/.hgrc</filename> won't
 	work for remote users on laptops, and of course local users
 	can subvert it at will by overriding the hook.
       </para>
 
     <para>You add an entry to the <literal
 	role="rc-hooks">hooks</literal> section of your <filename
-	role="special"> /.hgrc</filename>.  On the left is the name of
+	role="special">~/.hgrc</filename>.  On the left is the name of
       the event to trigger on; on the right is the action to take.  As
       you can see, you can run an arbitrary shell command in a hook.
       Mercurial passes extra information to the hook using environment
       <title>Writing an external hook</title>
 
       <para>When you define an external hook in your <filename
-	  role="special"> /.hgrc</filename>\ and the hook is run, its
+	  role="special">~/.hgrc</filename> and the hook is run, its
 	value is passed to your shell, which interprets it.  This
 	means that you can use normal shell constructs in the body of
 	the hook.
     <sect2>
       <title>Telling Mercurial to use an in-process hook</title>
 
-      <para>The <filename role="special"> /.hgrc</filename>\ syntax
+      <para>The <filename role="special">~/.hgrc</filename> syntax
 	for defining an in-process hook is slightly different than for
 	an executable hook.  The value of the hook must start with the
 	text <quote><literal>python:</literal></quote>, and continue
 	  work</quote>.
       </para>
 
-      <para>The following <filename role="special"> /.hgrc</filename>\
+      <para>The following <filename role="special">~/.hgrc</filename>
 	example snippet illustrates the syntax and meaning of the
 	notions we just described.
       </para>
-      <programlisting>[hooks] commit.example =
-	python:mymodule.submodule.myhook</programlisting>
+      <programlisting>[hooks]
+commit.example = python:mymodule.submodule.myhook</programlisting>
       <para>When Mercurial runs the <literal>commit.example</literal>
 	hook, it imports <literal>mymodule.submodule</literal>, looks
 	for the callable object named <literal>myhook</literal>, and
 	the basic shape of the hook API:
       </para>
       <programlisting>def myhook(ui, repo, **kwargs):
-	pass</programlisting>
+    pass</programlisting>
       <para>The first argument to a Python hook is always a <literal
 	  role="py-mod-mercurial.ui">ui</literal> object.  The second
 	is a repository object; at the moment, it is always an
 	  changeset, and roll back a group of changesets if they
 	  modify <quote>forbidden</quote> files.  Example:
 	</para>
-	<programlisting>[hooks] pretxnchangegroup.acl =
-	  python:hgext.acl.hook</programlisting>
+	<programlisting>[hooks]
+pretxnchangegroup.acl = python:hgext.acl.hook</programlisting>
 
 	<para>The <literal role="hg-ext">acl</literal> extension is
 	  configured using three sections.
 	  to any file or directory except <filename
 	    class="directory">source/sensitive</filename>.
 	</para>
-	<programlisting>[acl.allow] docs/** = docwriter [acl.deny]
-	  source/sensitive/** = intern</programlisting>
+	<programlisting>[acl.allow]
+docs/** = docwriter
+[acl.deny]
+source/sensitive/** = intern</programlisting>
 
       </sect3>
       <sect3>
 	  possible) to pass in the <option
 	    role="hg-opt-global">--debug</option> option, don't forget
 	  that you can enable debugging output in your <filename
-	    role="special"> /.hgrc</filename>:
+	    role="special">~/.hgrc</filename>:
 	</para>
-	<programlisting>[ui] debug = true</programlisting>
+	<programlisting>[ui]
+debug = true</programlisting>
 	<para>With this enabled, the <literal
 	    role="hg-ext">acl</literal> hook will print enough
 	  information to let you figure out why it is allowing or
 	  hook</title>
 
 	<para>You should configure this hook in your server's
-	  <filename role="special"> /.hgrc</filename>\ as an <literal
+	  <filename role="special">~/.hgrc</filename> as an <literal
 	    role="hook">incoming</literal> hook, for example as
 	  follows:
 	</para>
-	<programlisting>[hooks] incoming.bugzilla =
-	  python:hgext.bugzilla.hook</programlisting>
+	<programlisting>[hooks]
+incoming.bugzilla = python:hgext.bugzilla.hook</programlisting>
 
 	<para>Because of the specialised nature of this hook, and
 	  because Bugzilla was not written with this kind of
 
 	<para>Configuration information for this hook lives in the
 	  <literal role="rc-bugzilla">bugzilla</literal> section of
-	  your <filename role="special"> /.hgrc</filename>.
+	  your <filename role="special">~/.hgrc</filename>.
 	</para>
 	<itemizedlist>
 	  <listitem><para><envar
 	      password for the user you configured above.  This is
 	      stored as plain text, so you should make sure that
 	      unauthorised users cannot read the <filename
-		role="special"> /.hgrc</filename>\ file where you
+		role="special">~/.hgrc</filename> file where you
 	      store this information.
 	    </para>
 	  </listitem>
 	  email address on the left, and a Bugzilla user name on the
 	  right.
 	</para>
-	<programlisting>[usermap] jane.user@example.com =
-	  jane</programlisting>
+	<programlisting>[usermap]
+jane.user@example.com = jane</programlisting>
 	<para>You can either keep the <literal
 	    role="rc-usermap">usermap</literal> data in a normal
 	  <filename role="special">~/.hgrc</filename>, or tell the
 	  a user-modifiable repository.  This makes it possible to let
 	  your users maintain their own <envar
 	    role="rc-item-bugzilla">usermap</envar> entries.  The main
-	  <filename role="special"> /.hgrc</filename>\ file might look
+	  <filename role="special">~/.hgrc</filename> file might look
 	  like this:
 	</para>
-	<programlisting># regular hgrc file refers to external usermap
-	  file [bugzilla] usermap =
-	  /home/hg/repos/userdata/bugzilla-usermap.conf</programlisting>
+	<programlisting># regular hgrc file refers to external usermap file
+[bugzilla]
+usermap = /home/hg/repos/userdata/bugzilla-usermap.conf</programlisting>
 	<para>While the <filename>usermap</filename> file that it
 	  refers to might look like this:
 	</para>
-	<programlisting># bugzilla-usermap.conf - inside a hg
-	  repository [usermap] stephanie@example.com =
-	  steph</programlisting>
+	<programlisting># bugzilla-usermap.conf - inside a hg repository
+[usermap] stephanie@example.com = steph</programlisting>
 
       </sect3>
       <sect3>
 
 	<para>You can configure the text that this hook adds as a
 	  comment; you specify it in the form of a Mercurial template.
-	  Several <filename role="special"> /.hgrc</filename>\ entries
+	  Several <filename role="special">~/.hgrc</filename> entries
 	  (still in the <literal role="rc-bugzilla">bugzilla</literal>
 	  section) control this behaviour.
 	</para>
 	<para>In addition, you can add a <envar
 	    role="rc-item-web">baseurl</envar> item to the <literal
 	    role="rc-web">web</literal> section of your <filename
-	    role="special"> /.hgrc</filename>.  The <literal
+	    role="special">~/.hgrc</filename>.  The <literal
 	    role="hg-ext">bugzilla</literal> hook will make this
 	  available when expanding a template, as the base string to
 	  use when constructing a URL that will let users browse from
 	  a Bugzilla comment to view a changeset.  Example:
 	</para>
-	<programlisting>[web] baseurl =
-	  http://hg.domain.com/</programlisting>
+	<programlisting>[web]
+baseurl = http://hg.domain.com/</programlisting>
 
 	<para>Here is an example set of <literal
 	    role="hg-ext">bugzilla</literal> hook config information.
 	</para>
-	<programlisting>[bugzilla] host = bugzilla.example.com
-	  password = mypassword version = 2.16 # server-side repos
-	  live in /home/hg/repos, so strip 4 leading # separators
-	  strip = 4 hgweb = http://hg.example.com/ usermap =
-	  /home/hg/repos/notify/bugzilla.conf template = Changeset
-	  {node|short}, made by {author} in the {webroot} repo, refers
-	  to this bug.\\nFor complete details, see
-	  {hgweb}{webroot}?cmd=changeset;node={node|short}\\nChangeset
-	  description:\\n\\t{desc|tabindent}</programlisting>
+
+	&ch10-bugzilla-config.lst;
 
       </sect3>
       <sect3>
 	  <command>sudo</command> command.  Here is an example entry
 	  for a <filename>sudoers</filename> file.
 	</para>
-	<programlisting>hg_user = (httpd_user) NOPASSWD:
-	  /var/www/html/bugzilla/processmail-wrapper
-	  %s</programlisting>
+	<programlisting>hg_user = (httpd_user)
+NOPASSWD: /var/www/html/bugzilla/processmail-wrapper %s</programlisting>
 	<para>This allows the <literal>hg_user</literal> user to run a
 	  <filename>processmail-wrapper</filename> program under the
 	  identity of <literal>httpd_user</literal>.
 	  <filename>sudoers</filename> file.  The contents of the
 	  wrapper script are simple:
 	</para>
-	<programlisting>#!/bin/sh cd `dirname $0` &amp;&amp;
-	  ./processmail "$1" nobody@example.com</programlisting>
+	<programlisting>#!/bin/sh
+cd `dirname $0` &amp;&amp; ./processmail "$1" nobody@example.com</programlisting>
 	<para>It doesn't seem to matter what email address you pass to
 	  <filename>processmail</filename>.
 	</para>
 	  push changes to the server.  The error message will look
 	  like this:
 	</para>
-	<programlisting>cannot find bugzilla user id for
-	  john.q.public@example.com</programlisting>
+	<programlisting>cannot find bugzilla user id for john.q.public@example.com</programlisting>
 	<para>What this means is that the committer's address,
 	  <literal>john.q.public@example.com</literal>, is not a valid
 	  Bugzilla user name, nor does it have an entry in your
 	  changesets (all those that arrived in a single pull or
 	  push).
 	</para>
-	<programlisting>[hooks] # send one email per group of changes
-	  changegroup.notify = python:hgext.notify.hook # send one
-	  email per change incoming.notify =
-	  python:hgext.notify.hook</programlisting>
+	<programlisting>[hooks]
+# send one email per group of changes
+changegroup.notify = python:hgext.notify.hook
+# send one email per change
+incoming.notify = python:hgext.notify.hook</programlisting>
 
 	<para>Configuration information for this hook lives in the
 	  <literal role="rc-notify">notify</literal> section of a
-	  <filename role="special"> /.hgrc</filename>\ file.
+	  <filename role="special">~/.hgrc</filename> file.
 	</para>
 	<itemizedlist>
 	  <listitem><para><envar role="rc-item-notify">test</envar>:
 	  <listitem><para><envar role="rc-item-notify">config</envar>:
 	      The path to a configuration file that contains
 	      subscription information.  This is kept separate from
-	      the main <filename role="special"> /.hgrc</filename>\ so
+	      the main <filename role="special">~/.hgrc</filename> so
 	      that you can maintain it in a repository of its own.
 	      People can then clone that repository, update their
 	      subscriptions, and push the changes back to your server.
 	<para>Here is an example set of <literal
 	    role="hg-ext">notify</literal> configuration information.
 	</para>
-	<programlisting>
-	  [notify] # really send email test = false # subscriber data
-	  lives in the notify repo config =
-	  /home/hg/repos/notify/notify.conf # repos live in
-	  /home/hg/repos on server, so strip 4 "/" chars strip = 4
-	  template = X-Hg-Repo: {webroot} Subject: {webroot}:
-	  {desc|firstline|strip} From: {author} changeset {node|short}
-	  in {root} details:
-	  {baseurl}{webroot}?cmd=changeset;node={node|short}
-	  description: {desc|tabindent|strip} [web] baseurl =
-	  http://hg.example.com/
-	</programlisting>
+
+	&ch10-notify-config.lst;
 
 	<para>This will produce a message that looks like the
 	  following:
 	</para>
-	<programlisting>
-	  X-Hg-Repo: tests/slave Subject: tests/slave: Handle error
-	  case when slave has no buffers Date: Wed,  2 Aug 2006
-	  15:25:46 -0700 (PDT) changeset 3cba9bfe74b5 in
-	  /home/hg/repos/tests/slave details:
-	  http://hg.example.com/tests/slave?cmd=changeset;node=3cba9bfe74b5 
-	  description: Handle error case when slave has no buffers
-	  diffs (54 lines): diff -r 9d95df7cf2ad -r 3cba9bfe74b5
-	  include/tests.h --- a/include/tests.h      Wed Aug 02
-	  15:19:52 2006 -0700 +++ b/include/tests.h      Wed Aug 02
-	  15:25:26 2006 -0700 @@ -212,6 +212,15 @@ static __inline__
-	  void test_headers(void *h) [...snip...]
-	</programlisting>
+
+	&ch10-notify-config-mail.lst;
 
       </sect3>
       <sect3>
       <para>An in-process hook is called with arguments of the
 	following form:
       </para>
-      <programlisting>
-	def myhook(ui, repo, **kwargs): pass
-      </programlisting>
+      <programlisting>def myhook(ui, repo, **kwargs): pass</programlisting>
       <para>The <literal>ui</literal> parameter is a <literal
 	  role="py-mod-mercurial.ui">ui</literal> object. The
 	<literal>repo</literal> parameter is a <literal
       <para>Note that changeset IDs are passed into Python hooks as
 	hexadecimal strings, not the binary hashes that Mercurial's
 	APIs normally use.  To convert a hash from hex to binary, use
-	the \pymodfunc{mercurial.node}{bin} function.
+	the <literal>bin</literal> function.
       </para>
 
     </sect2>
 	<listitem><para><literal>node</literal>: A changeset ID.  The
 	    changeset ID of the first changeset in the group that was
 	    added.  All changesets between this and
-	    \index{tags!<literal>tip</literal>}<literal>tip</literal>,
-	    inclusive, were added by a single <command
-	      role="hg-cmd">hg pull</command>, <command
+	    <literal role="tag">tip</literal>, inclusive, were added by a single
+	    <command role="hg-cmd">hg pull</command>, <command
 	      role="hg-cmd">hg push</command> or <command
 	      role="hg-cmd">hg unbundle</command>.
 	  </para>
 	<listitem><para><literal>node</literal>: A changeset ID.  The
 	    changeset ID of the first changeset in the group that was
 	    added.  All changesets between this and
-	    \index{tags!<literal>tip</literal>}<literal>tip</literal>,
+	    <literal role="tag">tip</literal>,
 	    inclusive, were added by a single <command
 	      role="hg-cmd">hg pull</command>, <command
 	      role="hg-cmd">hg push</command> or <command

en/ch11-template.xml

       <title>Setting a default style</title>
 
       <para>You can modify the output style that Mercurial will use
-	for every command by editing your <filename role="special">
-	  /.hgrc</filename>\ file, naming the style you would prefer
-	to use.</para>
+	for every command by editing your <filename
+	  role="special">~/.hgrc</filename> file, naming the style
+	you would prefer to use.</para>
 
-      <programlisting>[ui] style = compact</programlisting>
+      <programlisting>[ui]
+style = compact</programlisting>
 
       <para>If you write a style of your own, you can use it by either
 	providing the path to your style file, or copying your style
       single replacement, as described below.</para>
 
     <itemizedlist>
-      <listitem><para><literal>\textbackslash\textbackslash</literal>:
+      <listitem><para><literal>\</literal>:
 	  Backslash, <quote><literal>\</literal></quote>, ASCII
 	  134.</para>
       </listitem>
-      <listitem><para><literal>\textbackslash n</literal>: Newline,
+      <listitem><para><literal>\n</literal>: Newline,
 	  ASCII 12.</para>
       </listitem>
-      <listitem><para><literal>\textbackslash r</literal>: Carriage
+      <listitem><para><literal>\r</literal>: Carriage
 	  return, ASCII 15.</para>
       </listitem>
-      <listitem><para><literal>\textbackslash t</literal>: Tab, ASCII
+      <listitem><para><literal>\t</literal>: Tab, ASCII
 	  11.</para>
       </listitem>
-      <listitem><para><literal>\textbackslash v</literal>: Vertical
+      <listitem><para><literal>\v</literal>: Vertical
 	  tab, ASCII 13.</para>
       </listitem>
-      <listitem><para><literal>\textbackslash {</literal>: Open curly
+      <listitem><para><literal>{</literal>: Open curly
 	  brace, <quote><literal>{</literal></quote>, ASCII
 	  173.</para>
       </listitem>
-      <listitem><para><literal>\textbackslash }</literal>: Close curly
+      <listitem><para><literal>}</literal>: Close curly
 	  brace, <quote><literal>}</literal></quote>, ASCII
 	  175.</para>
       </listitem></itemizedlist>
       <itemizedlist>
 	<listitem><para>The first component is simply Mercurial's way
 	    of saying <quote>I am giving up</quote>.</para>
-	  <programlisting>___abort___: broken.style:1: parse
-	    error</programlisting>
+	  <programlisting>___abort___: broken.style:1: parse error</programlisting>
 	</listitem>
 	<listitem><para>Next comes the name of the style file that
 	    contains the error.</para>
-	  <programlisting>
-	    abort: ___broken.style___:1: parse error
-	  </programlisting>
+	  <programlisting>abort: ___broken.style___:1: parse error</programlisting>
 	</listitem>
 	<listitem><para>Following the file name is the line number
 	    where the error was encountered.</para>
-	  <programlisting>abort: broken.style:___1___: parse
-	    error</programlisting>
+	  <programlisting>abort: broken.style:___1___: parse error</programlisting>
 	</listitem>
 	<listitem><para>Finally, a description of what went
 	    wrong.</para>
-	  <programlisting>abort: broken.style:1: ___parse
-	    error___</programlisting>
+	  <programlisting>abort: broken.style:1: ___parse error___</programlisting>
 	</listitem>
 	<listitem><para>The description of the problem is not always
 	    clear (as in this case), but even when it is cryptic, it
 	role="home">~/.hgrc</filename> file, and add the lines
       below.</para>
 
-    <programlisting>[extensions] hgext.mq =</programlisting>
+    <programlisting>[extensions]
+hgext.mq =</programlisting>
 
     <para>Once the extension is enabled, it will make a number of new
       commands available.  To verify that the extension is working,
 	      role="hg-opt-update">-C</option></command> to override
 	  the patches you have pushed.</para>
       </listitem>
-      <listitem><para>Merge all patches using
-	  \hgcmdargs{qpush}{<option role="hg-ext-mq-cmd-qpush-opt">hg
-	    -m</option> <option role="hg-ext-mq-cmd-qpush-opt">hg
-	    -a</option>}.  The <option
-	    role="hg-ext-mq-cmd-qpush-opt">hg -m</option> option to
+      <listitem><para>Merge all patches using <command>hg qpush -m
+	    -a</command>.  The <option
+	    role="hg-ext-mq-cmd-qpush-opt">-m</option> option to
 	  <command role="hg-ext-mq">qpush</command> tells MQ to
 	  perform a three-way merge if the patch fails to
 	  apply.</para>
       changeset ID will also accept the name of an applied patch.  MQ
       augments the tags normally in the repository with an eponymous
       one for each applied patch.  In addition, the special tags
-      \index{tags!special tag
-      names!<literal>qbase</literal>}<literal>qbase</literal> and
-      \index{tags!special tag
-      names!<literal>qtip</literal>}<literal>qtip</literal> identify
+      <literal role="tag">qbase</literal> and
+      <literal role="tag">qtip</literal> identify
       the <quote>bottom-most</quote> and topmost applied patches,
       respectively.</para>
 
     <itemizedlist>
       <listitem><para>Want to patchbomb a mailing list with your
 	  latest series of changes?</para>
-	<programlisting>hg email qbase:qtip
-	</programlisting>
+	<programlisting>hg email qbase:qtip</programlisting>
 	<para>  (Don't know what <quote>patchbombing</quote> is?  See
 	  section <xref linkend="sec:hgext:patchbomb"/>.)</para>
       </listitem>
       <listitem><para>Need to see all of the patches since
 	  <literal>foo.patch</literal> that have touched files in a
 	  subdirectory of your tree?</para>
-	<programlisting>
-	  hg log -r foo.patch:qtip <emphasis>subdir</emphasis>
-	</programlisting>
+	<programlisting>hg log -r foo.patch:qtip subdir</programlisting>
       </listitem>
     </itemizedlist>
 
 	snippet in your <filename
 	  role="home">~/.bashrc</filename>.</para>
 
-      <programlisting>alias mq=`hg -R $(hg
-	root)/.hg/patches'</programlisting>
+      <programlisting>alias mq=`hg -R $(hg root)/.hg/patches'</programlisting>
 
       <para>You can then issue commands of the form <command>mq
 	  pull</command> from the main repository.</para>

en/ch13-mq-collab.xml

 	  role="hg-ext">extdiff</literal> extension in the usual way,
 	by adding a line to the <literal
 	  role="rc-extensions">extensions</literal> section of your
-	<filename role="special"> /.hgrc</filename>.</para>
-      <programlisting>[extensions] extdiff =</programlisting>
+	<filename role="special">~/.hgrc</filename>.</para>
+      <programlisting>[extensions]
+extdiff =</programlisting>
       <para>The <command>interdiff</command> command expects to be
 	passed the names of two files, but the <literal
 	  role="hg-ext">extdiff</literal> extension passes the program
       <para>With the <filename role="special">hg-interdiff</filename>
 	program in your shell's search path, you can run it as
 	follows, from inside an MQ patch directory:</para>
-      <programlisting>hg extdiff -p hg-interdiff -r A:B
-	my-change.patch</programlisting>
+      <programlisting>hg extdiff -p hg-interdiff -r A:B my-change.patch</programlisting>
       <para>Since you'll probably want to use this long-winded command
 	a lot, you can get <literal role="hg-ext">hgext</literal> to
 	make it available as a normal Mercurial command, again by
-	editing your <filename role="special">
-	  /.hgrc</filename>.</para>
-      <programlisting>[extdiff] cmd.interdiff =
-	hg-interdiff</programlisting>
+	editing your <filename
+	  role="special">~/.hgrc</filename>.</para>
+      <programlisting>[extdiff]
+cmd.interdiff = hg-interdiff</programlisting>
       <para>This directs <literal role="hg-ext">hgext</literal> to
 	make an <literal>interdiff</literal> command available, so you
 	can now shorten the previous invocation of <command
 	  role="hg-ext-extdiff">extdiff</command> to something a
 	little more wieldy.</para>
-      <programlisting>hg interdiff -r A:B
-	my-change.patch</programlisting>
+      <programlisting>hg interdiff -r A:B my-change.patch</programlisting>
 
       <note>
 	<para>  The <command>interdiff</command> command works well

en/ch14-hgext.xml

     <orderedlist>
       <listitem><para>Clone the Python <literal>inotify</literal>
 	  binding repository.  Build and install it.</para>
-	<programlisting>
-	  hg clone http://hg.kublai.com/python/inotify cd inotify
-	  python setup.py build --force sudo python setup.py install
-	  --skip-build
-	</programlisting>
+	<programlisting>hg clone http://hg.kublai.com/python/inotify
+cd inotify
+python setup.py build --force
+sudo python setup.py install --skip-build</programlisting>
       </listitem>
       <listitem><para>Clone the <filename
 	    class="directory">crew</filename> Mercurial repository.
 	  repository so that Mercurial Queues will be able to apply
 	  patches to your cope of the <filename
 	    class="directory">crew</filename> repository.</para>
-	<programlisting>
-	  hg clone http://hg.intevation.org/mercurial/crew hg clone
-	  crew inotify hg clone
-	  http://hg.kublai.com/mercurial/patches/inotify
-	  inotify/.hg/patches
-	</programlisting>
+	<programlisting>hg clone http://hg.intevation.org/mercurial/crew
+hg clone crew inotify
+hg clone http://hg.kublai.com/mercurial/patches/inotify inotify/.hg/patches</programlisting>
       </listitem>
       <listitem><para>Make sure that you have the Mercurial Queues
 	  extension, <literal role="hg-ext">mq</literal>, enabled.  If
 	  using the <option role="hg-ext-mq-cmd-qpush-opt">hg
 	    -a</option> option to the <command
 	    role="hg-ext-mq">qpush</command> command.</para>
-	<programlisting>
-	  cd inotify hg qpush -a
-	</programlisting>
+	<programlisting>cd inotify
+hg qpush -a</programlisting>
       </listitem>
       <listitem><para>  If you get an error message from <command
 	    role="hg-ext-mq">qpush</command>, you should not continue.
       </listitem>
       <listitem><para>Build and install the patched version of
 	  Mercurial.</para>
-	<programlisting>
-	  python setup.py build --force sudo python setup.py install
-	  --skip-build
-	</programlisting>
+	<programlisting>python setup.py build --force
+sudo python setup.py install --skip-build</programlisting>
       </listitem>
     </orderedlist>
     <para>Once you've build a suitably patched version of Mercurial,
       all you need to do to enable the <literal
 	role="hg-ext">inotify</literal> extension is add an entry to
-      your <filename role="special"> /.hgrc</filename>.</para>
+      your <filename role="special">~/.hgrc</filename>.</para>
     <programlisting>[extensions] inotify =</programlisting>
     <para>When the <literal role="hg-ext">inotify</literal> extension
       is enabled, Mercurial will automatically and transparently start
     <para>The <literal role="hg-ext">extdiff</literal> extension is
       bundled with Mercurial, so it's easy to set up.  In the <literal
 	role="rc-extensions">extensions</literal> section of your
-      <filename role="special"> /.hgrc</filename>, simply add a
+      <filename role="special">~/.hgrc</filename>, simply add a
       one-line entry to enable the extension.</para>
-    <programlisting>[extensions] extdiff =</programlisting>
+    <programlisting>[extensions]
+extdiff =</programlisting>
     <para>This introduces a command named <command
 	role="hg-ext-extdiff">extdiff</command>, which by default uses
       your system's <command>diff</command> command to generate a
 	<emphasis>new</emphasis> commands that will invoke your diff
 	viewer with exactly the right options.</para>
 
-      <para>All you need to do is edit your <filename role="special">
-	  /.hgrc</filename>, and add a section named <literal
-	  role="rc-extdiff">extdiff</literal>.  Inside this section,
-	you can define multiple commands.  Here's how to add a
-	<literal>kdiff3</literal> command.  Once you've defined this,
-	you can type <quote><literal>hg kdiff3</literal></quote> and
-	the <literal role="hg-ext">extdiff</literal> extension will
-	run <command>kdiff3</command> for you.</para>
-      <programlisting>[extdiff] cmd.kdiff3 =</programlisting>
+      <para>All you need to do is edit your <filename
+	  role="special">~/.hgrc</filename>, and add a section named
+	<literal role="rc-extdiff">extdiff</literal>.  Inside this
+	section, you can define multiple commands.  Here's how to add
+	a <literal>kdiff3</literal> command.  Once you've defined
+	this, you can type <quote><literal>hg kdiff3</literal></quote>
+	and the <literal role="hg-ext">extdiff</literal> extension
+	will run <command>kdiff3</command> for you.</para>
+      <programlisting>[extdiff]
+cmd.kdiff3 =</programlisting>
       <para>If you leave the right hand side of the definition empty,
 	as above, the <literal role="hg-ext">extdiff</literal>
 	extension uses the name of the command you defined as the name
 	be the same.  Here, we define a command named
 	<quote><literal>hg wibble</literal></quote>, which runs
 	<command>kdiff3</command>.</para>
-      <programlisting>[extdiff] cmd.wibble = kdiff3</programlisting>
+      <programlisting>[extdiff]
+ cmd.wibble = kdiff3</programlisting>
 
       <para>You can also specify the default options that you want to
 	invoke your diff viewing program with.  The prefix to use is
 	defines a <quote><literal>hg vimdiff</literal></quote> command
 	that runs the <command>vim</command> editor's
 	<literal>DirDiff</literal> extension.</para>
-      <programlisting>[extdiff] cmd.vimdiff = vim opts.vimdiff = -f
-	'+next' '+execute "DirDiff" argv(0) argv(1)'</programlisting>
+      <programlisting>[extdiff]
+ cmd.vimdiff = vim
+opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'</programlisting>
 
     </sect2>
   </sect1>
 	role="hg-ext">patchbomb</literal> extension takes just one or
       two lines in your <filename role="special">
 	/.hgrc</filename>.</para>
-    <programlisting>[extensions] patchbomb =</programlisting>
+    <programlisting>[extensions]
+patchbomb =</programlisting>
     <para>Once you've enabled the extension, you will have a new
       command available, named <command
 	role="hg-ext-patchbomb">email</command>.</para>

en/examples/auto-snippets.xml

 <!ENTITY ch06-apache-config.lst SYSTEM "results/ch06-apache-config.lst.out">
+<!ENTITY ch10-bugzilla-config.lst SYSTEM "results/ch10-bugzilla-config.lst.out">
+<!ENTITY ch10-notify-config-mail.lst SYSTEM "results/ch10-notify-config-mail.lst.out">
+<!ENTITY ch10-notify-config.lst SYSTEM "results/ch10-notify-config.lst.out">
 <!ENTITY interaction.backout.init SYSTEM "results/backout.init.out">
 <!ENTITY interaction.backout.manual.backout SYSTEM "results/backout.manual.backout.out">
 <!ENTITY interaction.backout.manual.cat SYSTEM "results/backout.manual.cat.out">

en/examples/ch10/bugzilla-config.lst

+[bugzilla]
+host = bugzilla.example.com
+password = mypassword version = 2.16
+# server-side repos live in /home/hg/repos, so strip 4 leading
+# separators
+strip = 4
+hgweb = http://hg.example.com/
+usermap = /home/hg/repos/notify/bugzilla.conf
+template = Changeset {node|short}, made by {author} in the {webroot}
+  repo, refers to this bug.\n
+  For complete details, see
+  {hgweb}{webroot}?cmd=changeset;node={node|short}\n
+  Changeset description:\n
+  \t{desc|tabindent}

en/examples/ch10/notify-config-mail.lst

+X-Hg-Repo: tests/slave
+Subject: tests/slave: Handle error case when slave has no buffers
+Date: Wed,  2 Aug 2006 15:25:46 -0700 (PDT)
+
+changeset 3cba9bfe74b5 in /home/hg/repos/tests/slave
+
+details:
+http://hg.example.com/tests/slave?cmd=changeset;node=3cba9bfe74b5 
+
+description: Handle error case when slave has no buffers
+
+diffs (54 lines):
+diff -r 9d95df7cf2ad -r 3cba9bfe74b5 include/tests.h
+--- a/include/tests.h      Wed Aug 02 15:19:52 2006 -0700
++++ b/include/tests.h      Wed Aug 02 15:25:26 2006 -0700
+@@ -212,6 +212,15 @@ static __inline__
+void test_headers(void *h)
+[...snip...]

en/examples/ch10/notify-config.lst

+[notify]
+# really send email
+test = false
+# subscriber data lives in the notify repo
+config = /home/hg/repos/notify/notify.conf
+# repos live in /home/hg/repos on server, so strip 4 "/" chars
+strip = 4
+template = X-Hg-Repo: {webroot}\n
+  Subject: {webroot}: {desc|firstline|strip}\n
+  From: {author}
+  \n\n
+  changeset {node|short} in {root}
+  \n\ndetails:
+  {baseurl}{webroot}?cmd=changeset;node={node|short}
+  description: {desc|tabindent|strip}
+
+[web]
+baseurl =
+http://hg.example.com/

en/examples/run-example

 import cStringIO
 import errno
 import getopt
+import glob
 import os
 import pty
 import re
     return None
         
 def result_name(name):
-    return os.path.join('results', name.replace(os.sep, '-'))
+    return os.path.normpath(os.path.join('results', name.replace(os.sep, '-')))
+
+def wopen(name):
+    path = os.path.dirname(name)
+    if path:
+        try:
+            os.makedirs(path)
+        except OSError, err:
+            if err.errno != errno.EEXIST:
+                raise
+    return open(name, 'w')
 
 class example:
     entities = dict.fromkeys(l.rstrip() for l in open('auto-snippets.xml'))
 
     def __init__(self, name, verbose, keep_change):
-        self.name = name
+        self.name = os.path.normpath(name)
         self.verbose = verbose
         self.keep_change = keep_change
+        
+    def status(self, s):
+        sys.stdout.write(s)
+        if not s.endswith('\n'):
+            sys.stdout.flush()
 
     def rename_output(self, base, ignore=[]):
         mangle_re = re.compile('(?:' + '|'.join(ignore) + ')')
             os.unlink(errname)
             return False
         else:
-            print >> sys.stderr, '\nOutput of %s has changed!' % baseq
+            print >> sys.stderr, '\nOutput of %s has changed!' % base
             if self.keep_change:
                 os.rename(errname, oldname)
                 return False
                 os.system('diff -u %s %s 1>&2' % (oldname, errname))
             return True
 
-def wopen(name):
-    path = os.path.dirname(name)
-    if path:
-        try:
-            os.makedirs(path)
-        except OSError, err:
-            if err.errno != errno.EEXIST:
-                raise
-    return open(name, 'w')
-
 class static_example(example):
     def run(self):
+        self.status('running %s\n' % self.name)
         s = open(self.name).read().rstrip()
         s = s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
         ofp = wopen(result_name(self.name + '.tmp'))
                 yield cfp.getvalue()
                 cfp.seek(0)
                 cfp.truncate()
-        
-    def status(self, s):
-        sys.stdout.write(s)
-        if not s.endswith('\n'):
-            sys.stdout.flush()
 
     def send(self, s):
         if self.verbose: