annotate en/mq.tex @ 7:339e75288632

More progress on MQ chapter and general support. Added a note environment. Fixed generated HTML so it wouldn't use huge escaped entities for everything. Wrote a small amount of actual content.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 26 Jun 2006 12:25:11 -0700
parents 33a2e7b9978d
children a25335b56825
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 \chapter{Managing change with Mercurial Queues}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2 \label{chap:mq}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 \section{The patch management problem}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 \label{sec:mq:patch-mgmt}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7 Here is a common scenario: you need to install a software package from
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 source, but you find a bug that you must fix in the source before you
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 can start using the package. You make your changes, forget about the
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 package for a while, and a few months later you need to upgrade to a
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 newer version of the package. If the newer version of the package
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 still has the bug, you must extract your fix from the older source
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13 tree and apply it against the newer version. This is a tedious task,
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14 and it's easy to make mistakes.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 This is a simple case of the ``patch management'' problem. You have
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17 an ``upstream'' source tree that you can't change; you need to make
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 some local changes on top of the upstream tree; and you'd like to be
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 able to keep those changes separate, so that you can apply them to
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20 newer versions of the upstream source.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22 The patch management problem arises in many situations. Probably the
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23 most visible is that a user of an open source software project will
3
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
24 contribute a bug fix or new feature to the project's maintainers in the
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 form of a patch.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27 Distributors of operating systems that include open source software
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28 often need to make changes to the packages they distribute so that
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29 they will build properly in their environments.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31 When you have few changes to maintain, it is easy to manage a single
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32 patch using the standard \texttt{diff} and \texttt{patch} programs.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
33 Once the number of changes grows, it starts to makes sense to maintain
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 patches as discrete ``chunks of work,'' so that for example a single
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35 patch will contain only one bug fix (the patch might modify several
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36 files, but it's doing ``only one thing''), and you may have a number
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 of such patches for different bugs you need fixed and local changes
3
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
38 you require. In this situation, if you submit a bug fix patch to the
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39 upstream maintainers of a package and they include your fix in a
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40 subsequent release, you can simply drop that single patch when you're
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 updating to the newer release.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
42
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43 Maintaining a single patch against an upstream tree is a little
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
44 tedious and error-prone, but not difficult. However, the complexity
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
45 of the problem grows rapidly as the number of patches you have to
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
46 maintain increases. With more than a tiny number of patches in hand,
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
47 understanding which ones you have applied and maintaining them moves
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
48 from messy to overwhelming.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
49
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50 Fortunately, Mercurial includes a powerful extension, Mercurial Queues
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
51 (or simply ``MQ''), that massively simplifies the patch management
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
52 problem.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
53
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
54 \section{The prehistory of Mercurial Queues}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
55 \label{sec:mq:history}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
56
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
57 During the late 1990s, several Linux kernel developers started to
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
58 maintain ``patch series'' that modified the behaviour of the Linux
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
59 kernel. Some of these series were focused on stability, some on
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
60 feature coverage, and others were more speculative.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
61
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
62 The sizes of these patch series grew rapidly. In 2002, Andrew Morton
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
63 published some shell scripts he had been using to automate the task of
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64 managing his patch queues. Andrew was successfully using these
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
65 scripts to manage hundreds (sometimes thousands) of patches on top of
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
66 the Linux kernel.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
68 \subsection{A patchwork quilt}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
69 \label{sec:mq:quilt}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
70
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
71
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
72 In early 2003, Andreas Gruenbacher and Martin Quinson borrowed the
2
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
73 approach of Andrew's scripts and published a tool called ``patchwork
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
74 quilt''~\cite{web:quilt}, or simply ``quilt''
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
75 (see~\cite{gruenbacher:2005} for a paper describing it). Because
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
76 quilt substantially automated patch management, it rapidly gained a
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
77 large following among open source software developers.
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
78
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
79 Quilt manages a \emph{stack of patches} on top of a directory tree.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
80 To begin, you tell quilt to manage a directory tree; it stores away
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
81 the names and contents of all files in the tree. To fix a bug, you
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
82 create a new patch (using a single command), edit the files you need
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
83 to fix, then ``refresh'' the patch.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
84
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
85 The refresh step causes quilt to scan the directory tree; it updates
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
86 the patch with all of the changes you have made. You can create
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
87 another patch on top of the first, which will track the changes
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
88 required to modify the tree from ``tree with one patch applied'' to
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
89 ``tree with two patches applied''.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
90
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
91 You can \emph{change} which patches are applied to the tree. If you
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
92 ``pop'' a patch, the changes made by that patch will vanish from the
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
93 directory tree. Quilt remembers which patches you have popped,
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
94 though, so you can ``push'' a popped patch again, and the directory
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
95 tree will be restored to contain the modifications in the patch. Most
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
96 importantly, you can run the ``refresh'' command at any time, and the
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
97 topmost applied patch will be updated. This means that you can, at
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
98 any time, change both which patches are applied and what
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
99 modifications those patches make.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
100
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
101 Quilt knows nothing about revision control tools, so it works equally
3
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
102 well on top of an unpacked tarball or a Subversion repository.
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
103
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
104 \subsection{From patchwork quilt to Mercurial Queues}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
105 \label{sec:mq:quilt-mq}
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
106
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
107 In mid-2005, Chris Mason took the features of quilt and wrote an
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
108 extension that he called Mercurial Queues, which added quilt-like
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
109 behaviour to Mercurial.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
110
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
111 The key difference between quilt and MQ is that quilt knows nothing
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
112 about revision control systems, while MQ is \emph{integrated} into
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
113 Mercurial. Each patch that you push is represented as a Mercurial
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
114 changeset. Pop a patch, and the changeset goes away.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
115
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
116 This integration makes understanding patches and debugging their
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
117 effects \emph{enormously} easier. Since every applied patch has an
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
118 associated changeset, you can use \hgcmdargs{log}{\emph{filename}} to
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
119 see which changesets and patches affected a file. You can use the
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
120 \hgext{bisect} extension to binary-search through all changesets and
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
121 applied patches to see where a bug got introduced or fixed. You can
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
122 use the \hgcmd{annotate} command to see which changeset or patch
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
123 modified a particular line of a source file. And so on.
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
124
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
125 Because quilt does not care about revision control tools, it is still
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
126 a tremendously useful piece of software to know about for situations
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
127 where you cannot use Mercurial and MQ.
2
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
128 \section{Getting started with Mercurial Queues}
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
129 \label{sec:mq:start}
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
130
3
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
131 Because MQ is implemented as an extension, you must explicitly enable
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
132 before you can use it. (You don't need to download anything; MQ ships
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
133 with the standard Mercurial distribution.) To enable MQ, edit your
4
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
134 \tildefile{.hgrc} file, and add the lines in figure~\ref{ex:mq:config}.
2
379a802c0210 Add bibliography.
Bryan O'Sullivan <bos@serpentine.com>
parents: 1
diff changeset
135
7
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
136 \begin{figure}[h]
4
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
137 \begin{codesample4}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
138 [extensions]
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
139 hgext.mq =
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
140 \end{codesample4}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
141 \label{ex:mq:config}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
142 \caption{Contents to add to \tildefile{.hgrc} to enable the MQ extension}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
143 \end{figure}
3
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
144
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
145 Once the extension is enabled, it will make a number of new commands
7
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
146 available. To verify that the extension is working, you can use
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
147 \hgcmd{help} to see if the \hgcmd{qinit} command is now available; see
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
148 the example in figure~\ref{ex:mq:enabled}.
3
906d9021f9e5 Making progress on autogenerated example output.
Bryan O'Sullivan <bos@serpentine.com>
parents: 2
diff changeset
149
7
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
150 \begin{figure}[h]
4
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
151 \interaction{mq.qinit-help.help}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
152 \caption{How to verify that MQ is enabled}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
153 \label{ex:mq:enabled}
33a2e7b9978d Make it possible to include example input and output from real programs.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3
diff changeset
154 \end{figure}
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
155
7
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
156 You can use MQ with \emph{any} Mercurial repository; to start, simply
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
157 prepare the repository using the \hgcmd{qinit} command (see
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
158 figure~\ref{ex:mq:qinit}). This command creates an empty directory
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
159 called \filename{.hg/patches}, where MQ will keep its metadata. As
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
160 with many Mercurial commands, the \hgcmd{qinit} command prints nothing
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
161 if it succeeds.
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
162
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
163 \begin{figure}[h]
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
164 \interaction{mq.tutorial.qinit}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
165 \caption{Preparing a repository for use with MQ}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
166 \label{ex:mq:qinit}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
167 \end{figure}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
168
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
169 \begin{figure}[h]
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
170 \interaction{mq.tutorial.qnew}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
171 \caption{Creating a new patch}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
172 \label{ex:mq:qnew}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
173 \end{figure}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
174
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
175 To commence work on a new patch, use the \hgcmd{qnew} command. This
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
176 command takes one argument, the name of the patch to create. MQ will
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
177 use this as the name of an actual file in the \filename{.hg/patches}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
178 directory, as you can see in figure~\ref{ex:mq:qnew}.
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
179
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
180 Now also present in the \filename{.hg/patches} directory are two new
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
181 files, \filename{series} and \filename{status}. The \filename{series}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
182 file lists all of the patches that MQ knows about for this repository,
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
183 with one patch per line. The \filename{status} file lists all of the
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
184 patches that MQ has \emph{applied} in this repository.
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
185
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
186 \begin{note}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
187 You may sometimes want to edit the \filename{series} file by hand;
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
188 for example, to change the sequence in which some patches are
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
189 applied. However, manually editing the \filename{status} file is
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
190 almost always a bad idea, as it's easy to corrupt MQ's idea of what
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
191 is happening.
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
192 \end{note}
339e75288632 More progress on MQ chapter and general support.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4
diff changeset
193
1
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
194 %%% Local Variables:
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
195 %%% mode: latex
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
196 %%% TeX-master: "00book"
04e469de601e Early content for chapter on MQ.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
197 %%% End: