hgbook

diff en/ch11-mq.xml @ 584:c838b3975bc6

Add IDs to paragraphs.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu Mar 19 21:18:52 2009 -0700 (2009-03-19)
parents 28b5a5befb08
children 4ce9d0754af3
line diff
     1.1 --- a/en/ch11-mq.xml	Thu Mar 19 20:54:12 2009 -0700
     1.2 +++ b/en/ch11-mq.xml	Thu Mar 19 21:18:52 2009 -0700
     1.3 @@ -7,7 +7,7 @@
     1.4    <sect1 id="sec:mq:patch-mgmt">
     1.5      <title>The patch management problem</title>
     1.6  
     1.7 -    <para>Here is a common scenario: you need to install a software
     1.8 +    <para id="x_3ac">Here is a common scenario: you need to install a software
     1.9        package from source, but you find a bug that you must fix in the
    1.10        source before you can start using the package.  You make your
    1.11        changes, forget about the package for a while, and a few months
    1.12 @@ -17,24 +17,24 @@
    1.13        the newer version.  This is a tedious task, and it's easy to
    1.14        make mistakes.</para>
    1.15  
    1.16 -    <para>This is a simple case of the <quote>patch management</quote>
    1.17 +    <para id="x_3ad">This is a simple case of the <quote>patch management</quote>
    1.18        problem.  You have an <quote>upstream</quote> source tree that
    1.19        you can't change; you need to make some local changes on top of
    1.20        the upstream tree; and you'd like to be able to keep those
    1.21        changes separate, so that you can apply them to newer versions
    1.22        of the upstream source.</para>
    1.23  
    1.24 -    <para>The patch management problem arises in many situations.
    1.25 +    <para id="x_3ae">The patch management problem arises in many situations.
    1.26        Probably the most visible is that a user of an open source
    1.27        software project will contribute a bug fix or new feature to the
    1.28        project's maintainers in the form of a patch.</para>
    1.29  
    1.30 -    <para>Distributors of operating systems that include open source
    1.31 +    <para id="x_3af">Distributors of operating systems that include open source
    1.32        software often need to make changes to the packages they
    1.33        distribute so that they will build properly in their
    1.34        environments.</para>
    1.35  
    1.36 -    <para>When you have few changes to maintain, it is easy to manage
    1.37 +    <para id="x_3b0">When you have few changes to maintain, it is easy to manage
    1.38        a single patch using the standard <command>diff</command> and
    1.39        <command>patch</command> programs (see section <xref
    1.40  	linkend="sec:mq:patch"/> for a discussion of these
    1.41 @@ -49,14 +49,14 @@
    1.42        your fix in a subsequent release, you can simply drop that
    1.43        single patch when you're updating to the newer release.</para>
    1.44  
    1.45 -    <para>Maintaining a single patch against an upstream tree is a
    1.46 +    <para id="x_3b1">Maintaining a single patch against an upstream tree is a
    1.47        little tedious and error-prone, but not difficult.  However, the
    1.48        complexity of the problem grows rapidly as the number of patches
    1.49        you have to maintain increases.  With more than a tiny number of
    1.50        patches in hand, understanding which ones you have applied and
    1.51        maintaining them moves from messy to overwhelming.</para>
    1.52  
    1.53 -    <para>Fortunately, Mercurial includes a powerful extension,
    1.54 +    <para id="x_3b2">Fortunately, Mercurial includes a powerful extension,
    1.55        Mercurial Queues (or simply <quote>MQ</quote>), that massively
    1.56        simplifies the patch management problem.</para>
    1.57  
    1.58 @@ -64,13 +64,13 @@
    1.59    <sect1 id="sec:mq:history">
    1.60      <title>The prehistory of Mercurial Queues</title>
    1.61  
    1.62 -    <para>During the late 1990s, several Linux kernel developers
    1.63 +    <para id="x_3b3">During the late 1990s, several Linux kernel developers
    1.64        started to maintain <quote>patch series</quote> that modified
    1.65        the behaviour of the Linux kernel.  Some of these series were
    1.66        focused on stability, some on feature coverage, and others were
    1.67        more speculative.</para>
    1.68  
    1.69 -    <para>The sizes of these patch series grew rapidly.  In 2002,
    1.70 +    <para id="x_3b4">The sizes of these patch series grew rapidly.  In 2002,
    1.71        Andrew Morton published some shell scripts he had been using to
    1.72        automate the task of managing his patch queues.  Andrew was
    1.73        successfully using these scripts to manage hundreds (sometimes
    1.74 @@ -79,7 +79,7 @@
    1.75      <sect2 id="sec:mq:quilt">
    1.76        <title>A patchwork quilt</title>
    1.77  
    1.78 -      <para>In early 2003, Andreas Gruenbacher and Martin Quinson
    1.79 +      <para id="x_3b5">In early 2003, Andreas Gruenbacher and Martin Quinson
    1.80  	borrowed the approach of Andrew's scripts and published a tool
    1.81  	called <quote>patchwork quilt</quote>
    1.82  	<citation>web:quilt</citation>, or simply <quote>quilt</quote>
    1.83 @@ -88,7 +88,7 @@
    1.84  	management, it rapidly gained a large following among open
    1.85  	source software developers.</para>
    1.86  
    1.87 -      <para>Quilt manages a <emphasis>stack of patches</emphasis> on
    1.88 +      <para id="x_3b6">Quilt manages a <emphasis>stack of patches</emphasis> on
    1.89  	top of a directory tree. To begin, you tell quilt to manage a
    1.90  	directory tree, and tell it which files you want to manage; it
    1.91  	stores away the names and contents of those files.  To fix a
    1.92 @@ -96,14 +96,14 @@
    1.93  	files you need to fix, then <quote>refresh</quote> the
    1.94  	patch.</para>
    1.95  
    1.96 -      <para>The refresh step causes quilt to scan the directory tree;
    1.97 +      <para id="x_3b7">The refresh step causes quilt to scan the directory tree;
    1.98  	it updates the patch with all of the changes you have made.
    1.99  	You can create another patch on top of the first, which will
   1.100  	track the changes required to modify the tree from <quote>tree
   1.101  	  with one patch applied</quote> to <quote>tree with two
   1.102  	  patches applied</quote>.</para>
   1.103  
   1.104 -      <para>You can <emphasis>change</emphasis> which patches are
   1.105 +      <para id="x_3b8">You can <emphasis>change</emphasis> which patches are
   1.106  	applied to the tree.  If you <quote>pop</quote> a patch, the
   1.107  	changes made by that patch will vanish from the directory
   1.108  	tree.  Quilt remembers which patches you have popped, though,
   1.109 @@ -115,7 +115,7 @@
   1.110  	any time, change both which patches are applied and what
   1.111  	modifications those patches make.</para>
   1.112  
   1.113 -      <para>Quilt knows nothing about revision control tools, so it
   1.114 +      <para id="x_3b9">Quilt knows nothing about revision control tools, so it
   1.115  	works equally well on top of an unpacked tarball or a
   1.116  	Subversion working copy.</para>
   1.117  
   1.118 @@ -123,17 +123,17 @@
   1.119      <sect2 id="sec:mq:quilt-mq">
   1.120        <title>From patchwork quilt to Mercurial Queues</title>
   1.121  
   1.122 -      <para>In mid-2005, Chris Mason took the features of quilt and
   1.123 +      <para id="x_3ba">In mid-2005, Chris Mason took the features of quilt and
   1.124  	wrote an extension that he called Mercurial Queues, which
   1.125  	added quilt-like behaviour to Mercurial.</para>
   1.126  
   1.127 -      <para>The key difference between quilt and MQ is that quilt
   1.128 +      <para id="x_3bb">The key difference between quilt and MQ is that quilt
   1.129  	knows nothing about revision control systems, while MQ is
   1.130  	<emphasis>integrated</emphasis> into Mercurial.  Each patch
   1.131  	that you push is represented as a Mercurial changeset.  Pop a
   1.132  	patch, and the changeset goes away.</para>
   1.133  
   1.134 -      <para>Because quilt does not care about revision control tools,
   1.135 +      <para id="x_3bc">Because quilt does not care about revision control tools,
   1.136  	it is still a tremendously useful piece of software to know
   1.137  	about for situations where you cannot use Mercurial and
   1.138  	MQ.</para>
   1.139 @@ -143,16 +143,16 @@
   1.140    <sect1>
   1.141      <title>The huge advantage of MQ</title>
   1.142  
   1.143 -    <para>I cannot overstate the value that MQ offers through the
   1.144 +    <para id="x_3bd">I cannot overstate the value that MQ offers through the
   1.145        unification of patches and revision control.</para>
   1.146  
   1.147 -    <para>A major reason that patches have persisted in the free
   1.148 +    <para id="x_3be">A major reason that patches have persisted in the free
   1.149        software and open source world&emdash;in spite of the
   1.150        availability of increasingly capable revision control tools over
   1.151        the years&emdash;is the <emphasis>agility</emphasis> they
   1.152        offer.</para>
   1.153  
   1.154 -    <para>Traditional revision control tools make a permanent,
   1.155 +    <para id="x_3bf">Traditional revision control tools make a permanent,
   1.156        irreversible record of everything that you do.  While this has
   1.157        great value, it's also somewhat stifling.  If you want to
   1.158        perform a wild-eyed experiment, you have to be careful in how
   1.159 @@ -160,7 +160,7 @@
   1.160        misleading or destabilising&emdash;traces of your missteps and
   1.161        errors in the permanent revision record.</para>
   1.162  
   1.163 -    <para>By contrast, MQ's marriage of distributed revision control
   1.164 +    <para id="x_3c0">By contrast, MQ's marriage of distributed revision control
   1.165        with patches makes it much easier to isolate your work.  Your
   1.166        patches live on top of normal revision history, and you can make
   1.167        them disappear or reappear at will.  If you don't like a patch,
   1.168 @@ -168,7 +168,7 @@
   1.169        simply fix it&emdash;as many times as you need to, until you
   1.170        have refined it into the form you desire.</para>
   1.171  
   1.172 -    <para>As an example, the integration of patches with revision
   1.173 +    <para id="x_3c1">As an example, the integration of patches with revision
   1.174        control makes understanding patches and debugging their
   1.175        effects&emdash;and their interplay with the code they're based
   1.176        on&emdash;<emphasis>enormously</emphasis> easier. Since every
   1.177 @@ -186,11 +186,11 @@
   1.178    <sect1 id="sec:mq:patch">
   1.179      <title>Understanding patches</title>
   1.180  
   1.181 -    <para>Because MQ doesn't hide its patch-oriented nature, it is
   1.182 +    <para id="x_3c2">Because MQ doesn't hide its patch-oriented nature, it is
   1.183        helpful to understand what patches are, and a little about the
   1.184        tools that work with them.</para>
   1.185  
   1.186 -    <para>The traditional Unix <command>diff</command> command
   1.187 +    <para id="x_3c3">The traditional Unix <command>diff</command> command
   1.188        compares two files, and prints a list of differences between
   1.189        them. The <command>patch</command> command understands these
   1.190        differences as <emphasis>modifications</emphasis> to make to a
   1.191 @@ -199,20 +199,20 @@
   1.192  
   1.193  &interaction.mq.dodiff.diff;
   1.194  
   1.195 -    <para>The type of file that <command>diff</command> generates (and
   1.196 +    <para id="x_3c4">The type of file that <command>diff</command> generates (and
   1.197        <command>patch</command> takes as input) is called a
   1.198        <quote>patch</quote> or a <quote>diff</quote>; there is no
   1.199        difference between a patch and a diff.  (We'll use the term
   1.200        <quote>patch</quote>, since it's more commonly used.)</para>
   1.201  
   1.202 -    <para>A patch file can start with arbitrary text; the
   1.203 +    <para id="x_3c5">A patch file can start with arbitrary text; the
   1.204        <command>patch</command> command ignores this text, but MQ uses
   1.205        it as the commit message when creating changesets.  To find the
   1.206        beginning of the patch content, <command>patch</command>
   1.207        searches for the first line that starts with the string
   1.208        <quote><literal>diff -</literal></quote>.</para>
   1.209  
   1.210 -    <para>MQ works with <emphasis>unified</emphasis> diffs
   1.211 +    <para id="x_3c6">MQ works with <emphasis>unified</emphasis> diffs
   1.212        (<command>patch</command> can accept several other diff formats,
   1.213        but MQ doesn't).  A unified diff contains two kinds of header.
   1.214        The <emphasis>file header</emphasis> describes the file being
   1.215 @@ -220,7 +220,7 @@
   1.216        <command>patch</command> sees a new file header, it looks for a
   1.217        file with that name to start modifying.</para>
   1.218  
   1.219 -    <para>After the file header comes a series of
   1.220 +    <para id="x_3c7">After the file header comes a series of
   1.221        <emphasis>hunks</emphasis>.  Each hunk starts with a header;
   1.222        this identifies the range of line numbers within the file that
   1.223        the hunk should modify.  Following the header, a hunk starts and
   1.224 @@ -232,7 +232,7 @@
   1.225        runs the hunks together, with a few lines of context between
   1.226        modifications.</para>
   1.227  
   1.228 -    <para>Each line of context begins with a space character.  Within
   1.229 +    <para id="x_3c8">Each line of context begins with a space character.  Within
   1.230        the hunk, a line that begins with
   1.231        <quote><literal>-</literal></quote> means <quote>remove this
   1.232  	line,</quote> while a line that begins with
   1.233 @@ -240,7 +240,7 @@
   1.234  	line.</quote>  For example, a line that is modified is
   1.235        represented by one deletion and one insertion.</para>
   1.236  
   1.237 -    <para>We will return to some of the more subtle aspects of patches
   1.238 +    <para id="x_3c9">We will return to some of the more subtle aspects of patches
   1.239        later (in section <xref linkend="sec:mq:adv-patch"/>), but you
   1.240        should have
   1.241        enough information now to use MQ.</para>
   1.242 @@ -249,7 +249,7 @@
   1.243    <sect1 id="sec:mq:start">
   1.244      <title>Getting started with Mercurial Queues</title>
   1.245  
   1.246 -    <para>Because MQ is implemented as an extension, you must
   1.247 +    <para id="x_3ca">Because MQ is implemented as an extension, you must
   1.248        explicitly enable before you can use it.  (You don't need to
   1.249        download anything; MQ ships with the standard Mercurial
   1.250        distribution.)  To enable MQ, edit your <filename
   1.251 @@ -259,7 +259,7 @@
   1.252      <programlisting>[extensions]
   1.253  hgext.mq =</programlisting>
   1.254  
   1.255 -    <para>Once the extension is enabled, it will make a number of new
   1.256 +    <para id="x_3cb">Once the extension is enabled, it will make a number of new
   1.257        commands available.  To verify that the extension is working,
   1.258        you can use <command role="hg-cmd">hg help</command> to see if
   1.259        the <command role="hg-ext-mq">qinit</command> command is now
   1.260 @@ -267,14 +267,14 @@
   1.261  
   1.262  &interaction.mq.qinit-help.help;
   1.263  
   1.264 -    <para>You can use MQ with <emphasis>any</emphasis> Mercurial
   1.265 +    <para id="x_3cc">You can use MQ with <emphasis>any</emphasis> Mercurial
   1.266        repository, and its commands only operate within that
   1.267        repository.  To get started, simply prepare the repository using
   1.268        the <command role="hg-ext-mq">qinit</command> command.</para>
   1.269  
   1.270  &interaction.mq.tutorial.qinit;
   1.271  
   1.272 -    <para>This command creates an empty directory called <filename
   1.273 +    <para id="x_3cd">This command creates an empty directory called <filename
   1.274  	role="special" class="directory">.hg/patches</filename>, where
   1.275        MQ will keep its metadata.  As with many Mercurial commands, the
   1.276        <command role="hg-ext-mq">qinit</command> command prints nothing
   1.277 @@ -283,18 +283,18 @@
   1.278      <sect2>
   1.279        <title>Creating a new patch</title>
   1.280  
   1.281 -      <para>To begin work on a new patch, use the <command
   1.282 +      <para id="x_3ce">To begin work on a new patch, use the <command
   1.283  	  role="hg-ext-mq">qnew</command> command.  This command takes
   1.284  	one argument, the name of the patch to create.</para>
   1.285  
   1.286 -      <para>MQ will use this as the name of an actual file in the
   1.287 +      <para id="x_3cf">MQ will use this as the name of an actual file in the
   1.288  	<filename role="special"
   1.289  	  class="directory">.hg/patches</filename> directory, as you
   1.290  	can see below.</para>
   1.291  
   1.292  &interaction.mq.tutorial.qnew;
   1.293  
   1.294 -      <para>Also newly present in the <filename role="special"
   1.295 +      <para id="x_3d0">Also newly present in the <filename role="special"
   1.296  	  class="directory">.hg/patches</filename> directory are two
   1.297  	other files, <filename role="special">series</filename> and
   1.298  	<filename role="special">status</filename>.  The <filename
   1.299 @@ -306,7 +306,7 @@
   1.300  	<emphasis>applied</emphasis> in this repository.</para>
   1.301  
   1.302        <note>
   1.303 -	<para>  You may sometimes want to edit the <filename
   1.304 +	<para id="x_3d1">  You may sometimes want to edit the <filename
   1.305  	    role="special">series</filename> file by hand; for
   1.306  	  example, to change the sequence in which some patches are
   1.307  	  applied.  However, manually editing the <filename
   1.308 @@ -315,7 +315,7 @@
   1.309  	  happening.</para>
   1.310        </note>
   1.311  
   1.312 -      <para>Once you have created your new patch, you can edit files
   1.313 +      <para id="x_3d2">Once you have created your new patch, you can edit files
   1.314  	in the working directory as you usually would.  All of the
   1.315  	normal Mercurial commands, such as <command role="hg-cmd">hg
   1.316  	  diff</command> and <command role="hg-cmd">hg
   1.317 @@ -325,17 +325,17 @@
   1.318      <sect2>
   1.319        <title>Refreshing a patch</title>
   1.320  
   1.321 -      <para>When you reach a point where you want to save your work,
   1.322 +      <para id="x_3d3">When you reach a point where you want to save your work,
   1.323  	use the <command role="hg-ext-mq">qrefresh</command> command
   1.324  	to update the patch you are working on.</para>
   1.325  
   1.326  &interaction.mq.tutorial.qrefresh;
   1.327  
   1.328 -      <para>This command folds the changes you have made in the
   1.329 +      <para id="x_3d4">This command folds the changes you have made in the
   1.330  	working directory into your patch, and updates its
   1.331  	corresponding changeset to contain those changes.</para>
   1.332  
   1.333 -      <para>You can run <command role="hg-ext-mq">qrefresh</command>
   1.334 +      <para id="x_3d5">You can run <command role="hg-ext-mq">qrefresh</command>
   1.335  	as often as you like, so it's a good way to
   1.336  	<quote>checkpoint</quote> your work.  Refresh your patch at an
   1.337  	opportune time; try an experiment; and if the experiment
   1.338 @@ -348,19 +348,19 @@
   1.339      <sect2>
   1.340        <title>Stacking and tracking patches</title>
   1.341  
   1.342 -      <para>Once you have finished working on a patch, or need to work
   1.343 +      <para id="x_3d6">Once you have finished working on a patch, or need to work
   1.344  	on another, you can use the <command
   1.345  	  role="hg-ext-mq">qnew</command> command again to create a
   1.346  	new patch. Mercurial will apply this patch on top of your
   1.347  	existing patch.</para>
   1.348  
   1.349  &interaction.mq.tutorial.qnew2;
   1.350 -      <para>Notice that the patch contains the changes in our prior
   1.351 +      <para id="x_3d7">Notice that the patch contains the changes in our prior
   1.352  	patch as part of its context (you can see this more clearly in
   1.353  	the output of <command role="hg-cmd">hg
   1.354  	  annotate</command>).</para>
   1.355  
   1.356 -      <para>So far, with the exception of <command
   1.357 +      <para id="x_3d8">So far, with the exception of <command
   1.358  	  role="hg-ext-mq">qnew</command> and <command
   1.359  	  role="hg-ext-mq">qrefresh</command>, we've been careful to
   1.360  	only use regular Mercurial commands.  However, MQ provides
   1.361 @@ -370,13 +370,13 @@
   1.362  &interaction.mq.tutorial.qseries;
   1.363  
   1.364        <itemizedlist>
   1.365 -	<listitem><para>The <command
   1.366 +	<listitem><para id="x_3d9">The <command
   1.367  	      role="hg-ext-mq">qseries</command> command lists every
   1.368  	    patch that MQ knows about in this repository, from oldest
   1.369  	    to newest (most recently
   1.370  	    <emphasis>created</emphasis>).</para>
   1.371  	</listitem>
   1.372 -	<listitem><para>The <command
   1.373 +	<listitem><para id="x_3da">The <command
   1.374  	      role="hg-ext-mq">qapplied</command> command lists every
   1.375  	    patch that MQ has <emphasis>applied</emphasis> in this
   1.376  	    repository, again from oldest to newest (most recently
   1.377 @@ -387,12 +387,12 @@
   1.378      <sect2>
   1.379        <title>Manipulating the patch stack</title>
   1.380  
   1.381 -      <para>The previous discussion implied that there must be a
   1.382 +      <para id="x_3db">The previous discussion implied that there must be a
   1.383  	difference between <quote>known</quote> and
   1.384  	<quote>applied</quote> patches, and there is.  MQ can manage a
   1.385  	patch without it being applied in the repository.</para>
   1.386  
   1.387 -      <para>An <emphasis>applied</emphasis> patch has a corresponding
   1.388 +      <para id="x_3dc">An <emphasis>applied</emphasis> patch has a corresponding
   1.389  	changeset in the repository, and the effects of the patch and
   1.390  	changeset are visible in the working directory.  You can undo
   1.391  	the application of a patch using the <command
   1.392 @@ -407,12 +407,12 @@
   1.393        <informalfigure id="fig:mq:stack">
   1.394  	<mediaobject><imageobject><imagedata
   1.395  				    fileref="mq-stack"/></imageobject><textobject><phrase>XXX 
   1.396 -	      add text</phrase></textobject><caption><para>Applied and
   1.397 +	      add text</phrase></textobject><caption><para id="x_3dd">Applied and
   1.398  	      unapplied patches in the MQ patch
   1.399  	      stack</para></caption></mediaobject>
   1.400        </informalfigure>
   1.401  
   1.402 -      <para>You can reapply an unapplied, or popped, patch using the
   1.403 +      <para id="x_3de">You can reapply an unapplied, or popped, patch using the
   1.404  	<command role="hg-ext-mq">qpush</command> command.  This
   1.405  	creates a new changeset to correspond to the patch, and the
   1.406  	patch's changes once again become present in the working
   1.407 @@ -421,7 +421,7 @@
   1.408  	  role="hg-ext-mq">qpush</command> in action.</para>
   1.409  &interaction.mq.tutorial.qpop;
   1.410  
   1.411 -      <para>Notice that once we have popped a patch or two patches,
   1.412 +      <para id="x_3df">Notice that once we have popped a patch or two patches,
   1.413  	the output of <command role="hg-ext-mq">qseries</command>
   1.414  	remains the same, while that of <command
   1.415  	  role="hg-ext-mq">qapplied</command> has changed.</para>
   1.416 @@ -431,7 +431,7 @@
   1.417      <sect2>
   1.418        <title>Pushing and popping many patches</title>
   1.419  
   1.420 -      <para>While <command role="hg-ext-mq">qpush</command> and
   1.421 +      <para id="x_3e0">While <command role="hg-ext-mq">qpush</command> and
   1.422  	<command role="hg-ext-mq">qpop</command> each operate on a
   1.423  	single patch at a time by default, you can push and pop many
   1.424  	patches in one go.  The <option
   1.425 @@ -450,7 +450,7 @@
   1.426      <sect2>
   1.427        <title>Safety checks, and overriding them</title>
   1.428  
   1.429 -      <para>Several MQ commands check the working directory before
   1.430 +      <para id="x_3e1">Several MQ commands check the working directory before
   1.431  	they do anything, and fail if they find any modifications.
   1.432  	They do this to ensure that you won't lose any changes that
   1.433  	you have made, but not yet incorporated into a patch.  The
   1.434 @@ -462,7 +462,7 @@
   1.435  
   1.436  &interaction.mq.tutorial.add;
   1.437  
   1.438 -      <para>Commands that check the working directory all take an
   1.439 +      <para id="x_3e2">Commands that check the working directory all take an
   1.440  	<quote>I know what I'm doing</quote> option, which is always
   1.441  	named <option>-f</option>.  The exact meaning of
   1.442  	<option>-f</option> depends on the command.  For example,
   1.443 @@ -479,14 +479,14 @@
   1.444      <sect2>
   1.445        <title>Working on several patches at once</title>
   1.446  
   1.447 -      <para>The <command role="hg-ext-mq">qrefresh</command> command
   1.448 +      <para id="x_3e3">The <command role="hg-ext-mq">qrefresh</command> command
   1.449  	always refreshes the <emphasis>topmost</emphasis> applied
   1.450  	patch.  This means that you can suspend work on one patch (by
   1.451  	refreshing it), pop or push to make a different patch the top,
   1.452  	and work on <emphasis>that</emphasis> patch for a
   1.453  	while.</para>
   1.454  
   1.455 -      <para>Here's an example that illustrates how you can use this
   1.456 +      <para id="x_3e4">Here's an example that illustrates how you can use this
   1.457  	ability. Let's say you're developing a new feature as two
   1.458  	patches.  The first is a change to the core of your software,
   1.459  	and the second&emdash;layered on top of the
   1.460 @@ -505,7 +505,7 @@
   1.461    <sect1 id="sec:mq:adv-patch">
   1.462      <title>More about patches</title>
   1.463  
   1.464 -    <para>MQ uses the GNU <command>patch</command> command to apply
   1.465 +    <para id="x_3e5">MQ uses the GNU <command>patch</command> command to apply
   1.466        patches, so it's helpful to know a few more detailed aspects of
   1.467        how <command>patch</command> works, and about patches
   1.468        themselves.</para>
   1.469 @@ -513,14 +513,14 @@
   1.470      <sect2>
   1.471        <title>The strip count</title>
   1.472  
   1.473 -      <para>If you look at the file headers in a patch, you will
   1.474 +      <para id="x_3e6">If you look at the file headers in a patch, you will
   1.475  	notice that the pathnames usually have an extra component on
   1.476  	the front that isn't present in the actual path name.  This is
   1.477  	a holdover from the way that people used to generate patches
   1.478  	(people still do this, but it's somewhat rare with modern
   1.479  	revision control tools).</para>
   1.480  
   1.481 -      <para>Alice would unpack a tarball, edit her files, then decide
   1.482 +      <para id="x_3e7">Alice would unpack a tarball, edit her files, then decide
   1.483  	that she wanted to create a patch.  So she'd rename her
   1.484  	working directory, unpack the tarball again (hence the need
   1.485  	for the rename), and use the <option
   1.486 @@ -533,7 +533,7 @@
   1.487  	header, and the name of the modified directory would be at the
   1.488  	front of the right-hand path.</para>
   1.489  
   1.490 -      <para>Since someone receiving a patch from the Alices of the net
   1.491 +      <para id="x_3e8">Since someone receiving a patch from the Alices of the net
   1.492  	would be unlikely to have unmodified and modified directories
   1.493  	with exactly the same names, the <command>patch</command>
   1.494  	command has a <option role="cmd-opt-patch">-p</option> option
   1.495 @@ -541,7 +541,7 @@
   1.496  	strip when trying to apply a patch.  This number is called the
   1.497  	<emphasis>strip count</emphasis>.</para>
   1.498  
   1.499 -      <para>An option of <quote><literal>-p1</literal></quote> means
   1.500 +      <para id="x_3e9">An option of <quote><literal>-p1</literal></quote> means
   1.501  	<quote>use a strip count of one</quote>.  If
   1.502  	<command>patch</command> sees a file name
   1.503  	<filename>foo/bar/baz</filename> in a file header, it will
   1.504 @@ -554,7 +554,7 @@
   1.505  	but <filename>/foo/bar</filename> (notice the extra leading
   1.506  	slash) into <filename>foo/bar</filename>.)</para>
   1.507  
   1.508 -      <para>The <quote>standard</quote> strip count for patches is
   1.509 +      <para id="x_3ea">The <quote>standard</quote> strip count for patches is
   1.510  	one; almost all patches contain one leading path name
   1.511  	component that needs to be stripped. Mercurial's <command
   1.512  	  role="hg-cmd">hg diff</command> command generates path names
   1.513 @@ -562,7 +562,7 @@
   1.514  	  import</command> command and MQ expect patches to have a
   1.515  	strip count of one.</para>
   1.516  
   1.517 -      <para>If you receive a patch from someone that you want to add
   1.518 +      <para id="x_3eb">If you receive a patch from someone that you want to add
   1.519  	to your patch queue, and the patch needs a strip count other
   1.520  	than one, you cannot just <command
   1.521  	  role="hg-ext-mq">qimport</command> the patch, because
   1.522 @@ -583,14 +583,14 @@
   1.523      <sect2>
   1.524        <title>Strategies for applying a patch</title>
   1.525  
   1.526 -      <para>When <command>patch</command> applies a hunk, it tries a
   1.527 +      <para id="x_3ec">When <command>patch</command> applies a hunk, it tries a
   1.528  	handful of successively less accurate strategies to try to
   1.529  	make the hunk apply. This falling-back technique often makes
   1.530  	it possible to take a patch that was generated against an old
   1.531  	version of a file, and apply it against a newer version of
   1.532  	that file.</para>
   1.533  
   1.534 -      <para>First, <command>patch</command> tries an exact match,
   1.535 +      <para id="x_3ed">First, <command>patch</command> tries an exact match,
   1.536  	where the line numbers, the context, and the text to be
   1.537  	modified must apply exactly.  If it cannot make an exact
   1.538  	match, it tries to find an exact match for the context,
   1.539 @@ -599,7 +599,7 @@
   1.540  	applied, but at some <emphasis>offset</emphasis> from the
   1.541  	original line number.</para>
   1.542  
   1.543 -      <para>If a context-only match fails, <command>patch</command>
   1.544 +      <para id="x_3ee">If a context-only match fails, <command>patch</command>
   1.545  	removes the first and last lines of the context, and tries a
   1.546  	<emphasis>reduced</emphasis> context-only match.  If the hunk
   1.547  	with reduced context succeeds, it prints a message saying that
   1.548 @@ -608,7 +608,7 @@
   1.549  	context <command>patch</command> had to trim before the patch
   1.550  	applied).</para>
   1.551  
   1.552 -      <para>When neither of these techniques works,
   1.553 +      <para id="x_3ef">When neither of these techniques works,
   1.554  	<command>patch</command> prints a message saying that the hunk
   1.555  	in question was rejected.  It saves rejected hunks (also
   1.556  	simply called <quote>rejects</quote>) to a file with the same
   1.557 @@ -628,36 +628,36 @@
   1.558      <sect2>
   1.559        <title>Some quirks of patch representation</title>
   1.560  
   1.561 -      <para>There are a few useful things to know about how
   1.562 +      <para id="x_3f0">There are a few useful things to know about how
   1.563  	<command>patch</command> works with files.</para>
   1.564        <itemizedlist>
   1.565 -	<listitem><para>This should already be obvious, but
   1.566 +	<listitem><para id="x_3f1">This should already be obvious, but
   1.567  	    <command>patch</command> cannot handle binary
   1.568  	    files.</para>
   1.569  	</listitem>
   1.570 -	<listitem><para>Neither does it care about the executable bit;
   1.571 +	<listitem><para id="x_3f2">Neither does it care about the executable bit;
   1.572  	    it creates new files as readable, but not
   1.573  	    executable.</para>
   1.574  	</listitem>
   1.575 -	<listitem><para><command>patch</command> treats the removal of
   1.576 +	<listitem><para id="x_3f3"><command>patch</command> treats the removal of
   1.577  	    a file as a diff between the file to be removed and the
   1.578  	    empty file.  So your idea of <quote>I deleted this
   1.579  	      file</quote> looks like <quote>every line of this file
   1.580  	      was deleted</quote> in a patch.</para>
   1.581  	</listitem>
   1.582 -	<listitem><para>It treats the addition of a file as a diff
   1.583 +	<listitem><para id="x_3f4">It treats the addition of a file as a diff
   1.584  	    between the empty file and the file to be added.  So in a
   1.585  	    patch, your idea of <quote>I added this file</quote> looks
   1.586  	    like <quote>every line of this file was
   1.587  	      added</quote>.</para>
   1.588  	</listitem>
   1.589 -	<listitem><para>It treats a renamed file as the removal of the
   1.590 +	<listitem><para id="x_3f5">It treats a renamed file as the removal of the
   1.591  	    old name, and the addition of the new name.  This means
   1.592  	    that renamed files have a big footprint in patches.  (Note
   1.593  	    also that Mercurial does not currently try to infer when
   1.594  	    files have been renamed or copied in a patch.)</para>
   1.595  	</listitem>
   1.596 -	<listitem><para><command>patch</command> cannot represent
   1.597 +	<listitem><para id="x_3f6"><command>patch</command> cannot represent
   1.598  	    empty files, so you cannot use a patch to represent the
   1.599  	    notion <quote>I added this empty file to the
   1.600  	      tree</quote>.</para>
   1.601 @@ -666,7 +666,7 @@
   1.602      <sect2>
   1.603        <title>Beware the fuzz</title>
   1.604  
   1.605 -      <para>While applying a hunk at an offset, or with a fuzz factor,
   1.606 +      <para id="x_3f7">While applying a hunk at an offset, or with a fuzz factor,
   1.607  	will often be completely successful, these inexact techniques
   1.608  	naturally leave open the possibility of corrupting the patched
   1.609  	file.  The most common cases typically involve applying a
   1.610 @@ -676,7 +676,7 @@
   1.611  	fuzz factor, you should make sure that the modified files are
   1.612  	correct afterwards.</para>
   1.613  
   1.614 -      <para>It's often a good idea to refresh a patch that has applied
   1.615 +      <para id="x_3f8">It's often a good idea to refresh a patch that has applied
   1.616  	with an offset or fuzz factor; refreshing the patch generates
   1.617  	new context information that will make it apply cleanly.  I
   1.618  	say <quote>often,</quote> not <quote>always,</quote> because
   1.619 @@ -691,30 +691,30 @@
   1.620      <sect2>
   1.621        <title>Handling rejection</title>
   1.622  
   1.623 -      <para>If <command role="hg-ext-mq">qpush</command> fails to
   1.624 +      <para id="x_3f9">If <command role="hg-ext-mq">qpush</command> fails to
   1.625  	apply a patch, it will print an error message and exit.  If it
   1.626  	has left <filename role="special">.rej</filename> files
   1.627  	behind, it is usually best to fix up the rejected hunks before
   1.628  	you push more patches or do any further work.</para>
   1.629  
   1.630 -      <para>If your patch <emphasis>used to</emphasis> apply cleanly,
   1.631 +      <para id="x_3fa">If your patch <emphasis>used to</emphasis> apply cleanly,
   1.632  	and no longer does because you've changed the underlying code
   1.633  	that your patches are based on, Mercurial Queues can help; see
   1.634  	section <xref
   1.635  	  linkend="sec:mq:merge"/> for details.</para>
   1.636  
   1.637 -      <para>Unfortunately, there aren't any great techniques for
   1.638 +      <para id="x_3fb">Unfortunately, there aren't any great techniques for
   1.639  	dealing with rejected hunks.  Most often, you'll need to view
   1.640  	the <filename role="special">.rej</filename> file and edit the
   1.641  	target file, applying the rejected hunks by hand.</para>
   1.642  
   1.643 -      <para>If you're feeling adventurous, Neil Brown, a Linux kernel
   1.644 +      <para id="x_3fc">If you're feeling adventurous, Neil Brown, a Linux kernel
   1.645  	hacker, wrote a tool called <command>wiggle</command>
   1.646  	<citation>web:wiggle</citation>, which is more vigorous than
   1.647  	<command>patch</command> in its attempts to make a patch
   1.648  	apply.</para>
   1.649  
   1.650 -      <para>Another Linux kernel hacker, Chris Mason (the author of
   1.651 +      <para id="x_3fd">Another Linux kernel hacker, Chris Mason (the author of
   1.652  	Mercurial Queues), wrote a similar tool called
   1.653  	<command>mpatch</command> <citation>web:mpatch</citation>,
   1.654  	which takes a simple approach to automating the application of
   1.655 @@ -723,21 +723,21 @@
   1.656  	reasons that a hunk may be rejected:</para>
   1.657  
   1.658        <itemizedlist>
   1.659 -	<listitem><para>The context in the middle of a hunk has
   1.660 +	<listitem><para id="x_3fe">The context in the middle of a hunk has
   1.661  	    changed.</para>
   1.662  	</listitem>
   1.663 -	<listitem><para>A hunk is missing some context at the
   1.664 +	<listitem><para id="x_3ff">A hunk is missing some context at the
   1.665  	    beginning or end.</para>
   1.666  	</listitem>
   1.667 -	<listitem><para>A large hunk might apply better&emdash;either
   1.668 +	<listitem><para id="x_400">A large hunk might apply better&emdash;either
   1.669  	    entirely or in part&emdash;if it was broken up into
   1.670  	    smaller hunks.</para>
   1.671  	</listitem>
   1.672 -	<listitem><para>A hunk removes lines with slightly different
   1.673 +	<listitem><para id="x_401">A hunk removes lines with slightly different
   1.674  	    content than those currently present in the file.</para>
   1.675  	</listitem></itemizedlist>
   1.676  
   1.677 -      <para>If you use <command>wiggle</command> or
   1.678 +      <para id="x_402">If you use <command>wiggle</command> or
   1.679  	<command>mpatch</command>, you should be doubly careful to
   1.680  	check your results when you're done.  In fact,
   1.681  	<command>mpatch</command> enforces this method of
   1.682 @@ -751,7 +751,7 @@
   1.683    <sect1 id="sec:mq:perf">
   1.684      <title>Getting the best performance out of MQ</title>
   1.685  
   1.686 -    <para>MQ is very efficient at handling a large number of patches.
   1.687 +    <para id="x_403">MQ is very efficient at handling a large number of patches.
   1.688        I ran some performance experiments in mid-2006 for a talk that I
   1.689        gave at the 2006 EuroPython conference
   1.690        <citation>web:europython</citation>.  I used as my data set the
   1.691 @@ -760,7 +760,7 @@
   1.692        all 27,472 revisions between Linux 2.6.12-rc2 and Linux
   1.693        2.6.17.</para>
   1.694  
   1.695 -    <para>On my old, slow laptop, I was able to <command
   1.696 +    <para id="x_404">On my old, slow laptop, I was able to <command
   1.697  	role="hg-cmd">hg qpush <option
   1.698  	  role="hg-ext-mq-cmd-qpush-opt">hg -a</option></command> all
   1.699        1,738 patches in 3.5 minutes, and <command role="hg-cmd">hg qpop
   1.700 @@ -771,11 +771,11 @@
   1.701        (which made 22,779 lines of changes to 287 files) in 6.6
   1.702        seconds.</para>
   1.703  
   1.704 -    <para>Clearly, MQ is well suited to working in large trees, but
   1.705 +    <para id="x_405">Clearly, MQ is well suited to working in large trees, but
   1.706        there are a few tricks you can use to get the best performance
   1.707        of it.</para>
   1.708  
   1.709 -    <para>First of all, try to <quote>batch</quote> operations
   1.710 +    <para id="x_406">First of all, try to <quote>batch</quote> operations
   1.711        together.  Every time you run <command
   1.712  	role="hg-ext-mq">qpush</command> or <command
   1.713  	role="hg-ext-mq">qpop</command>, these commands scan the
   1.714 @@ -786,7 +786,7 @@
   1.715        medium-sized tree (containing tens of thousands of files), it
   1.716        can take a second or more.</para>
   1.717  
   1.718 -    <para>The <command role="hg-ext-mq">qpush</command> and <command
   1.719 +    <para id="x_407">The <command role="hg-ext-mq">qpush</command> and <command
   1.720  	role="hg-ext-mq">qpop</command> commands allow you to push and
   1.721        pop multiple patches at a time.  You can identify the
   1.722        <quote>destination patch</quote> that you want to end up at.
   1.723 @@ -796,7 +796,7 @@
   1.724  	role="hg-ext-mq">qpop</command> to a destination, MQ will pop
   1.725        patches until the destination patch is at the top.</para>
   1.726  
   1.727 -    <para>You can identify a destination patch using either the name
   1.728 +    <para id="x_408">You can identify a destination patch using either the name
   1.729        of the patch, or by number.  If you use numeric addressing,
   1.730        patches are counted from zero; this means that the first patch
   1.731        is zero, the second is one, and so on.</para>
   1.732 @@ -806,7 +806,7 @@
   1.733      <title>Updating your patches when the underlying code
   1.734        changes</title>
   1.735  
   1.736 -    <para>It's common to have a stack of patches on top of an
   1.737 +    <para id="x_409">It's common to have a stack of patches on top of an
   1.738        underlying repository that you don't modify directly.  If you're
   1.739        working on changes to third-party code, or on a feature that is
   1.740        taking longer to develop than the rate of change of the code
   1.741 @@ -815,7 +815,7 @@
   1.742        This is called <emphasis>rebasing</emphasis> your patch
   1.743        series.</para>
   1.744  
   1.745 -    <para>The simplest way to do this is to <command role="hg-cmd">hg
   1.746 +    <para id="x_40a">The simplest way to do this is to <command role="hg-cmd">hg
   1.747  	qpop <option role="hg-ext-mq-cmd-qpop-opt">hg
   1.748  	  -a</option></command> your patches, then <command
   1.749  	role="hg-cmd">hg pull</command> changes into the underlying
   1.750 @@ -827,26 +827,26 @@
   1.751        affected patch, and continue pushing until you have fixed your
   1.752        entire stack.</para>
   1.753  
   1.754 -    <para>This approach is easy to use and works well if you don't
   1.755 +    <para id="x_40b">This approach is easy to use and works well if you don't
   1.756        expect changes to the underlying code to affect how well your
   1.757        patches apply. If your patch stack touches code that is modified
   1.758        frequently or invasively in the underlying repository, however,
   1.759        fixing up rejected hunks by hand quickly becomes
   1.760        tiresome.</para>
   1.761  
   1.762 -    <para>It's possible to partially automate the rebasing process.
   1.763 +    <para id="x_40c">It's possible to partially automate the rebasing process.
   1.764        If your patches apply cleanly against some revision of the
   1.765        underlying repo, MQ can use this information to help you to
   1.766        resolve conflicts between your patches and a different
   1.767        revision.</para>
   1.768  
   1.769 -    <para>The process is a little involved.</para>
   1.770 +    <para id="x_40d">The process is a little involved.</para>
   1.771      <orderedlist>
   1.772 -      <listitem><para>To begin, <command role="hg-cmd">hg qpush
   1.773 +      <listitem><para id="x_40e">To begin, <command role="hg-cmd">hg qpush
   1.774  	    -a</command> all of your patches on top of the revision
   1.775  	  where you know that they apply cleanly.</para>
   1.776        </listitem>
   1.777 -      <listitem><para>Save a backup copy of your patch directory using
   1.778 +      <listitem><para id="x_40f">Save a backup copy of your patch directory using
   1.779  	  <command role="hg-cmd">hg qsave <option
   1.780  	      role="hg-ext-mq-cmd-qsave-opt">hg -e</option> <option
   1.781  	      role="hg-ext-mq-cmd-qsave-opt">hg -c</option></command>.
   1.782 @@ -860,17 +860,17 @@
   1.783  	  states of the <filename role="special">series</filename> and
   1.784  	  <filename role="special">status</filename> files.</para>
   1.785        </listitem>
   1.786 -      <listitem><para>Use <command role="hg-cmd">hg pull</command> to
   1.787 +      <listitem><para id="x_410">Use <command role="hg-cmd">hg pull</command> to
   1.788  	  bring new changes into the underlying repository.  (Don't
   1.789  	  run <command role="hg-cmd">hg pull -u</command>; see below
   1.790  	  for why.)</para>
   1.791        </listitem>
   1.792 -      <listitem><para>Update to the new tip revision, using <command
   1.793 +      <listitem><para id="x_411">Update to the new tip revision, using <command
   1.794  	    role="hg-cmd">hg update <option
   1.795  	      role="hg-opt-update">-C</option></command> to override
   1.796  	  the patches you have pushed.</para>
   1.797        </listitem>
   1.798 -      <listitem><para>Merge all patches using <command>hg qpush -m
   1.799 +      <listitem><para id="x_412">Merge all patches using <command>hg qpush -m
   1.800  	    -a</command>.  The <option
   1.801  	    role="hg-ext-mq-cmd-qpush-opt">-m</option> option to
   1.802  	  <command role="hg-ext-mq">qpush</command> tells MQ to
   1.803 @@ -878,7 +878,7 @@
   1.804  	  apply.</para>
   1.805        </listitem></orderedlist>
   1.806  
   1.807 -    <para>During the <command role="hg-cmd">hg qpush <option
   1.808 +    <para id="x_413">During the <command role="hg-cmd">hg qpush <option
   1.809  	  role="hg-ext-mq-cmd-qpush-opt">hg -m</option></command>,
   1.810        each patch in the <filename role="special">series</filename>
   1.811        file is applied normally.  If a patch applies with fuzz or
   1.812 @@ -888,10 +888,10 @@
   1.813        Mercurial's normal merge machinery, so it may pop up a GUI merge
   1.814        tool to help you to resolve problems.</para>
   1.815  
   1.816 -    <para>When you finish resolving the effects of a patch, MQ
   1.817 +    <para id="x_414">When you finish resolving the effects of a patch, MQ
   1.818        refreshes your patch based on the result of the merge.</para>
   1.819  
   1.820 -    <para>At the end of this process, your repository will have one
   1.821 +    <para id="x_415">At the end of this process, your repository will have one
   1.822        extra head from the old patch queue, and a copy of the old patch
   1.823        queue will be in <filename role="special"
   1.824  	class="directory">.hg/patches.N</filename>. You can remove the
   1.825 @@ -905,26 +905,26 @@
   1.826    <sect1>
   1.827      <title>Identifying patches</title>
   1.828  
   1.829 -    <para>MQ commands that work with patches let you refer to a patch
   1.830 +    <para id="x_416">MQ commands that work with patches let you refer to a patch
   1.831        either by using its name or by a number.  By name is obvious
   1.832        enough; pass the name <filename>foo.patch</filename> to <command
   1.833  	role="hg-ext-mq">qpush</command>, for example, and it will
   1.834        push patches until <filename>foo.patch</filename> is
   1.835        applied.</para>
   1.836  
   1.837 -    <para>As a shortcut, you can refer to a patch using both a name
   1.838 +    <para id="x_417">As a shortcut, you can refer to a patch using both a name
   1.839        and a numeric offset; <literal>foo.patch-2</literal> means
   1.840        <quote>two patches before <literal>foo.patch</literal></quote>,
   1.841        while <literal>bar.patch+4</literal> means <quote>four patches
   1.842  	after <literal>bar.patch</literal></quote>.</para>
   1.843  
   1.844 -    <para>Referring to a patch by index isn't much different.  The
   1.845 +    <para id="x_418">Referring to a patch by index isn't much different.  The
   1.846        first patch printed in the output of <command
   1.847  	role="hg-ext-mq">qseries</command> is patch zero (yes, it's
   1.848        one of those start-at-zero counting systems); the second is
   1.849        patch one; and so on.</para>
   1.850  
   1.851 -    <para>MQ also makes it easy to work with patches when you are
   1.852 +    <para id="x_419">MQ also makes it easy to work with patches when you are
   1.853        using normal Mercurial commands.  Every command that accepts a
   1.854        changeset ID will also accept the name of an applied patch.  MQ
   1.855        augments the tags normally in the repository with an eponymous
   1.856 @@ -934,28 +934,28 @@
   1.857        the <quote>bottom-most</quote> and topmost applied patches,
   1.858        respectively.</para>
   1.859  
   1.860 -    <para>These additions to Mercurial's normal tagging capabilities
   1.861 +    <para id="x_41a">These additions to Mercurial's normal tagging capabilities
   1.862        make dealing with patches even more of a breeze.</para>
   1.863      <itemizedlist>
   1.864 -      <listitem><para>Want to patchbomb a mailing list with your
   1.865 +      <listitem><para id="x_41b">Want to patchbomb a mailing list with your
   1.866  	  latest series of changes?</para>
   1.867  	<programlisting>hg email qbase:qtip</programlisting>
   1.868 -	<para>  (Don't know what <quote>patchbombing</quote> is?  See
   1.869 +	<para id="x_41c">  (Don't know what <quote>patchbombing</quote> is?  See
   1.870  	  section <xref linkend="sec:hgext:patchbomb"/>.)</para>
   1.871        </listitem>
   1.872 -      <listitem><para>Need to see all of the patches since
   1.873 +      <listitem><para id="x_41d">Need to see all of the patches since
   1.874  	  <literal>foo.patch</literal> that have touched files in a
   1.875  	  subdirectory of your tree?</para>
   1.876  	<programlisting>hg log -r foo.patch:qtip subdir</programlisting>
   1.877        </listitem>
   1.878      </itemizedlist>
   1.879  
   1.880 -    <para>Because MQ makes the names of patches available to the rest
   1.881 +    <para id="x_41e">Because MQ makes the names of patches available to the rest
   1.882        of Mercurial through its normal internal tag machinery, you
   1.883        don't need to type in the entire name of a patch when you want
   1.884        to identify it by name.</para>
   1.885  
   1.886 -    <para>Another nice consequence of representing patch names as tags
   1.887 +    <para id="x_41f">Another nice consequence of representing patch names as tags
   1.888        is that when you run the <command role="hg-cmd">hg log</command>
   1.889        command, it will display a patch's name as a tag, simply as part
   1.890        of its normal output.  This makes it easy to visually
   1.891 @@ -970,12 +970,12 @@
   1.892    <sect1>
   1.893      <title>Useful things to know about</title>
   1.894  
   1.895 -    <para>There are a number of aspects of MQ usage that don't fit
   1.896 +    <para id="x_420">There are a number of aspects of MQ usage that don't fit
   1.897        tidily into sections of their own, but that are good to know.
   1.898        Here they are, in one place.</para>
   1.899  
   1.900      <itemizedlist>
   1.901 -      <listitem><para>Normally, when you <command
   1.902 +      <listitem><para id="x_421">Normally, when you <command
   1.903  	    role="hg-ext-mq">qpop</command> a patch and <command
   1.904  	    role="hg-ext-mq">qpush</command> it again, the changeset
   1.905  	  that represents the patch after the pop/push will have a
   1.906 @@ -984,7 +984,7 @@
   1.907  	    linkend="sec:mqref:cmd:qpush"/> for
   1.908  	  information as to why this is.</para>
   1.909        </listitem>
   1.910 -      <listitem><para>It's not a good idea to <command
   1.911 +      <listitem><para id="x_422">It's not a good idea to <command
   1.912  	    role="hg-cmd">hg merge</command> changes from another
   1.913  	  branch with a patch changeset, at least if you want to
   1.914  	  maintain the <quote>patchiness</quote> of that changeset and
   1.915 @@ -997,13 +997,13 @@
   1.916    <sect1 id="sec:mq:repo">
   1.917      <title>Managing patches in a repository</title>
   1.918  
   1.919 -    <para>Because MQ's <filename role="special"
   1.920 +    <para id="x_423">Because MQ's <filename role="special"
   1.921  	class="directory">.hg/patches</filename> directory resides
   1.922        outside a Mercurial repository's working directory, the
   1.923        <quote>underlying</quote> Mercurial repository knows nothing
   1.924        about the management or presence of patches.</para>
   1.925  
   1.926 -    <para>This presents the interesting possibility of managing the
   1.927 +    <para id="x_424">This presents the interesting possibility of managing the
   1.928        contents of the patch directory as a Mercurial repository in its
   1.929        own right.  This can be a useful way to work.  For example, you
   1.930        can work on a patch for a while, <command
   1.931 @@ -1012,7 +1012,7 @@
   1.932        patch.  This lets you <quote>roll back</quote> to that version
   1.933        of the patch later on.</para>
   1.934  
   1.935 -    <para>You can then share different versions of the same patch
   1.936 +    <para id="x_425">You can then share different versions of the same patch
   1.937        stack among multiple underlying repositories.  I use this when I
   1.938        am developing a Linux kernel feature.  I have a pristine copy of
   1.939        my kernel sources for each of several CPU architectures, and a
   1.940 @@ -1022,7 +1022,7 @@
   1.941        associated with that kernel tree, pop and push all of my
   1.942        patches, and build and test that kernel.</para>
   1.943  
   1.944 -    <para>Managing patches in a repository makes it possible for
   1.945 +    <para id="x_426">Managing patches in a repository makes it possible for
   1.946        multiple developers to work on the same patch series without
   1.947        colliding with each other, all on top of an underlying source
   1.948        base that they may or may not control.</para>
   1.949 @@ -1030,7 +1030,7 @@
   1.950      <sect2>
   1.951        <title>MQ support for patch repositories</title>
   1.952  
   1.953 -      <para>MQ helps you to work with the <filename role="special"
   1.954 +      <para id="x_427">MQ helps you to work with the <filename role="special"
   1.955  	  class="directory">.hg/patches</filename> directory as a
   1.956  	repository; when you prepare a repository for working with
   1.957  	patches using <command role="hg-ext-mq">qinit</command>, you
   1.958 @@ -1040,7 +1040,7 @@
   1.959  	Mercurial repository.</para>
   1.960  
   1.961        <note>
   1.962 -	<para>  If you forget to use the <option
   1.963 +	<para id="x_428">  If you forget to use the <option
   1.964  	    role="hg-ext-mq-cmd-qinit-opt">hg -c</option> option, you
   1.965  	  can simply go into the <filename role="special"
   1.966  	    class="directory">.hg/patches</filename> directory at any
   1.967 @@ -1049,25 +1049,25 @@
   1.968  	    role="special">status</filename> file to the <filename
   1.969  	    role="special">.hgignore</filename> file, though</para>
   1.970  
   1.971 -	<para>  (<command role="hg-cmd">hg qinit <option
   1.972 +	<para id="x_429">  (<command role="hg-cmd">hg qinit <option
   1.973  	      role="hg-ext-mq-cmd-qinit-opt">hg -c</option></command>
   1.974  	  does this for you automatically); you
   1.975  	  <emphasis>really</emphasis> don't want to manage the
   1.976  	  <filename role="special">status</filename> file.</para>
   1.977        </note>
   1.978  
   1.979 -      <para>As a convenience, if MQ notices that the <filename
   1.980 +      <para id="x_42a">As a convenience, if MQ notices that the <filename
   1.981  	  class="directory">.hg/patches</filename> directory is a
   1.982  	repository, it will automatically <command role="hg-cmd">hg
   1.983  	  add</command> every patch that you create and import.</para>
   1.984  
   1.985 -      <para>MQ provides a shortcut command, <command
   1.986 +      <para id="x_42b">MQ provides a shortcut command, <command
   1.987  	  role="hg-ext-mq">qcommit</command>, that runs <command
   1.988  	  role="hg-cmd">hg commit</command> in the <filename
   1.989  	  role="special" class="directory">.hg/patches</filename>
   1.990  	directory.  This saves some bothersome typing.</para>
   1.991  
   1.992 -      <para>Finally, as a convenience to manage the patch directory,
   1.993 +      <para id="x_42c">Finally, as a convenience to manage the patch directory,
   1.994  	you can define the alias <command>mq</command> on Unix
   1.995  	systems. For example, on Linux systems using the
   1.996  	<command>bash</command> shell, you can include the following
   1.997 @@ -1076,17 +1076,17 @@
   1.998  
   1.999        <programlisting>alias mq=`hg -R $(hg root)/.hg/patches'</programlisting>
  1.1000  
  1.1001 -      <para>You can then issue commands of the form <command>mq
  1.1002 +      <para id="x_42d">You can then issue commands of the form <command>mq
  1.1003  	  pull</command> from the main repository.</para>
  1.1004  
  1.1005      </sect2>
  1.1006      <sect2>
  1.1007        <title>A few things to watch out for</title>
  1.1008  
  1.1009 -      <para>MQ's support for working with a repository full of patches
  1.1010 +      <para id="x_42e">MQ's support for working with a repository full of patches
  1.1011  	is limited in a few small respects.</para>
  1.1012  
  1.1013 -      <para>MQ cannot automatically detect changes that you make to
  1.1014 +      <para id="x_42f">MQ cannot automatically detect changes that you make to
  1.1015  	the patch directory.  If you <command role="hg-cmd">hg
  1.1016  	  pull</command>, manually edit, or <command role="hg-cmd">hg
  1.1017  	  update</command> changes to patches or the <filename
  1.1018 @@ -1104,11 +1104,11 @@
  1.1019    <sect1 id="sec:mq:tools">
  1.1020      <title>Third party tools for working with patches</title>
  1.1021  
  1.1022 -    <para>Once you've been working with patches for a while, you'll
  1.1023 +    <para id="x_430">Once you've been working with patches for a while, you'll
  1.1024        find yourself hungry for tools that will help you to understand
  1.1025        and manipulate the patches you're dealing with.</para>
  1.1026  
  1.1027 -    <para>The <command>diffstat</command> command
  1.1028 +    <para id="x_431">The <command>diffstat</command> command
  1.1029        <citation>web:diffstat</citation> generates a histogram of the
  1.1030        modifications made to each file in a patch.  It provides a good
  1.1031        way to <quote>get a sense of</quote> a patch&emdash;which files
  1.1032 @@ -1122,7 +1122,7 @@
  1.1033  
  1.1034  &interaction.mq.tools.tools;
  1.1035  
  1.1036 -    <para>The <literal role="package">patchutils</literal> package
  1.1037 +    <para id="x_432">The <literal role="package">patchutils</literal> package
  1.1038        <citation>web:patchutils</citation> is invaluable. It provides a
  1.1039        set of small utilities that follow the <quote>Unix
  1.1040  	philosophy;</quote> each does one useful thing with a patch.
  1.1041 @@ -1140,13 +1140,13 @@
  1.1042    <sect1>
  1.1043      <title>Good ways to work with patches</title>
  1.1044  
  1.1045 -    <para>Whether you are working on a patch series to submit to a
  1.1046 +    <para id="x_433">Whether you are working on a patch series to submit to a
  1.1047        free software or open source project, or a series that you
  1.1048        intend to treat as a sequence of regular changesets when you're
  1.1049        done, you can use some simple techniques to keep your work well
  1.1050        organised.</para>
  1.1051  
  1.1052 -    <para>Give your patches descriptive names.  A good name for a
  1.1053 +    <para id="x_434">Give your patches descriptive names.  A good name for a
  1.1054        patch might be <filename>rework-device-alloc.patch</filename>,
  1.1055        because it will immediately give you a hint what the purpose of
  1.1056        the patch is.  Long names shouldn't be a problem; you won't be
  1.1057 @@ -1158,7 +1158,7 @@
  1.1058        to work with, or if you are juggling a number of different tasks
  1.1059        and your patches only get a fraction of your attention.</para>
  1.1060  
  1.1061 -    <para>Be aware of what patch you're working on.  Use the <command
  1.1062 +    <para id="x_435">Be aware of what patch you're working on.  Use the <command
  1.1063  	role="hg-ext-mq">qtop</command> command and skim over the text
  1.1064        of your patches frequently&emdash;for example, using <command
  1.1065  	role="hg-cmd">hg tip <option
  1.1066 @@ -1168,7 +1168,7 @@
  1.1067        one I intended, and it's often tricky to migrate changes into
  1.1068        the right patch after making them in the wrong one.</para>
  1.1069  
  1.1070 -    <para>For this reason, it is very much worth investing a little
  1.1071 +    <para id="x_436">For this reason, it is very much worth investing a little
  1.1072        time to learn how to use some of the third-party tools I
  1.1073        described in section <xref linkend="sec:mq:tools"/>,
  1.1074        particularly
  1.1075 @@ -1184,28 +1184,28 @@
  1.1076      <sect2>
  1.1077        <title>Manage <quote>trivial</quote> patches</title>
  1.1078  
  1.1079 -      <para>Because the overhead of dropping files into a new
  1.1080 +      <para id="x_437">Because the overhead of dropping files into a new
  1.1081  	Mercurial repository is so low, it makes a lot of sense to
  1.1082  	manage patches this way even if you simply want to make a few
  1.1083  	changes to a source tarball that you downloaded.</para>
  1.1084  
  1.1085 -      <para>Begin by downloading and unpacking the source tarball, and
  1.1086 +      <para id="x_438">Begin by downloading and unpacking the source tarball, and
  1.1087  	turning it into a Mercurial repository.</para>
  1.1088  
  1.1089        &interaction.mq.tarball.download;
  1.1090  
  1.1091 -      <para>Continue by creating a patch stack and making your
  1.1092 +      <para id="x_439">Continue by creating a patch stack and making your
  1.1093  	changes.</para>
  1.1094  
  1.1095        &interaction.mq.tarball.qinit;
  1.1096  
  1.1097 -      <para>Let's say a few weeks or months pass, and your package
  1.1098 +      <para id="x_43a">Let's say a few weeks or months pass, and your package
  1.1099  	author releases a new version.  First, bring their changes
  1.1100  	into the repository.</para>
  1.1101  
  1.1102        &interaction.mq.tarball.newsource;
  1.1103  
  1.1104 -      <para>The pipeline starting with <command role="hg-cmd">hg
  1.1105 +      <para id="x_43b">The pipeline starting with <command role="hg-cmd">hg
  1.1106  	  locate</command> above deletes all files in the working
  1.1107  	directory, so that <command role="hg-cmd">hg
  1.1108  	  commit</command>'s <option
  1.1109 @@ -1213,7 +1213,7 @@
  1.1110  	actually tell which files have really been removed in the
  1.1111  	newer version of the source.</para>
  1.1112  
  1.1113 -      <para>Finally, you can apply your patches on top of the new
  1.1114 +      <para id="x_43c">Finally, you can apply your patches on top of the new
  1.1115  	tree.</para>
  1.1116  
  1.1117        &interaction.mq.tarball.repush;
  1.1118 @@ -1222,7 +1222,7 @@
  1.1119      <sect2 id="sec:mq:combine">
  1.1120        <title>Combining entire patches</title>
  1.1121  
  1.1122 -      <para>MQ provides a command, <command
  1.1123 +      <para id="x_43d">MQ provides a command, <command
  1.1124  	  role="hg-ext-mq">qfold</command> that lets you combine
  1.1125  	entire patches.  This <quote>folds</quote> the patches you
  1.1126  	name, in the order you name them, into the topmost applied
  1.1127 @@ -1230,7 +1230,7 @@
  1.1128  	description.  The patches that you fold must be unapplied
  1.1129  	before you fold them.</para>
  1.1130  
  1.1131 -      <para>The order in which you fold patches matters.  If your
  1.1132 +      <para id="x_43e">The order in which you fold patches matters.  If your
  1.1133  	topmost applied patch is <literal>foo</literal>, and you
  1.1134  	<command role="hg-ext-mq">qfold</command>
  1.1135  	<literal>bar</literal> and <literal>quux</literal> into it,
  1.1136 @@ -1243,11 +1243,11 @@
  1.1137      <sect2>
  1.1138        <title>Merging part of one patch into another</title>
  1.1139  
  1.1140 -      <para>Merging <emphasis>part</emphasis> of one patch into
  1.1141 +      <para id="x_43f">Merging <emphasis>part</emphasis> of one patch into
  1.1142  	another is more difficult than combining entire
  1.1143  	patches.</para>
  1.1144  
  1.1145 -      <para>If you want to move changes to entire files, you can use
  1.1146 +      <para id="x_440">If you want to move changes to entire files, you can use
  1.1147  	<command>filterdiff</command>'s <option
  1.1148  	  role="cmd-opt-filterdiff">-i</option> and <option
  1.1149  	  role="cmd-opt-filterdiff">-x</option> options to choose the
  1.1150 @@ -1260,7 +1260,7 @@
  1.1151  	<command role="hg-ext-mq">qrefresh</command> the patch to drop
  1.1152  	the duplicate hunks.</para>
  1.1153  
  1.1154 -      <para>If you have a patch that has multiple hunks modifying a
  1.1155 +      <para id="x_441">If you have a patch that has multiple hunks modifying a
  1.1156  	file, and you only want to move a few of those hunks, the job
  1.1157  	becomes more messy, but you can still partly automate it.  Use
  1.1158  	<command>lsdiff -nvv</command> to print some metadata about
  1.1159 @@ -1268,21 +1268,21 @@
  1.1160  
  1.1161        &interaction.mq.tools.lsdiff;
  1.1162  
  1.1163 -      <para>This command prints three different kinds of
  1.1164 +      <para id="x_442">This command prints three different kinds of
  1.1165  	number:</para>
  1.1166        <itemizedlist>
  1.1167 -	<listitem><para>(in the first column) a <emphasis>file
  1.1168 +	<listitem><para id="x_443">(in the first column) a <emphasis>file
  1.1169  	      number</emphasis> to identify each file modified in the
  1.1170  	    patch;</para>
  1.1171  	</listitem>
  1.1172 -	<listitem><para>(on the next line, indented) the line number
  1.1173 +	<listitem><para id="x_444">(on the next line, indented) the line number
  1.1174  	    within a modified file where a hunk starts; and</para>
  1.1175  	</listitem>
  1.1176 -	<listitem><para>(on the same line) a <emphasis>hunk
  1.1177 +	<listitem><para id="x_445">(on the same line) a <emphasis>hunk
  1.1178  	      number</emphasis> to identify that hunk.</para>
  1.1179  	</listitem></itemizedlist>
  1.1180  
  1.1181 -      <para>You'll have to use some visual inspection, and reading of
  1.1182 +      <para id="x_446">You'll have to use some visual inspection, and reading of
  1.1183  	the patch, to identify the file and hunk numbers you'll want,
  1.1184  	but you can then pass them to to
  1.1185  	<command>filterdiff</command>'s <option
  1.1186 @@ -1290,7 +1290,7 @@
  1.1187  	  role="cmd-opt-filterdiff">--hunks</option> options, to
  1.1188  	select exactly the file and hunk you want to extract.</para>
  1.1189  
  1.1190 -      <para>Once you have this hunk, you can concatenate it onto the
  1.1191 +      <para id="x_447">Once you have this hunk, you can concatenate it onto the
  1.1192  	end of your destination patch and continue with the remainder
  1.1193  	of section <xref linkend="sec:mq:combine"/>.</para>
  1.1194  
  1.1195 @@ -1299,11 +1299,11 @@
  1.1196    <sect1>
  1.1197      <title>Differences between quilt and MQ</title>
  1.1198  
  1.1199 -    <para>If you are already familiar with quilt, MQ provides a
  1.1200 +    <para id="x_448">If you are already familiar with quilt, MQ provides a
  1.1201        similar command set.  There are a few differences in the way
  1.1202        that it works.</para>
  1.1203  
  1.1204 -    <para>You will already have noticed that most quilt commands have
  1.1205 +    <para id="x_449">You will already have noticed that most quilt commands have
  1.1206        MQ counterparts that simply begin with a
  1.1207        <quote><literal>q</literal></quote>.  The exceptions are quilt's
  1.1208        <literal>add</literal> and <literal>remove</literal> commands,