comparison en/mq-ref.tex @ 233:696b1e0c01df

Tag all MQ commands as belonging to the mq extension.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun, 27 May 2007 09:41:55 -0700
parents 34943a3d50d6
children 30e97616d808
comparison
equal deleted inserted replaced
232:2469608b4a08 233:696b1e0c01df
5 \label{sec:mqref:cmdref} 5 \label{sec:mqref:cmdref}
6 6
7 For an overview of the commands provided by MQ, use the command 7 For an overview of the commands provided by MQ, use the command
8 \hgcmdargs{help}{mq}. 8 \hgcmdargs{help}{mq}.
9 9
10 \subsection{\hgcmd{qapplied}---print applied patches} 10 \subsection{\hgxcmd{mq}{qapplied}---print applied patches}
11 11
12 The \hgcmd{qapplied} command prints the current stack of applied 12 The \hgxcmd{mq}{qapplied} command prints the current stack of applied
13 patches. Patches are printed in oldest-to-newest order, so the last 13 patches. Patches are printed in oldest-to-newest order, so the last
14 patch in the list is the ``top'' patch. 14 patch in the list is the ``top'' patch.
15 15
16 \subsection{\hgcmd{qcommit}---commit changes in the queue repository} 16 \subsection{\hgxcmd{mq}{qcommit}---commit changes in the queue repository}
17 17
18 The \hgcmd{qcommit} command commits any outstanding changes in the 18 The \hgxcmd{mq}{qcommit} command commits any outstanding changes in the
19 \sdirname{.hg/patches} repository. This command only works if the 19 \sdirname{.hg/patches} repository. This command only works if the
20 \sdirname{.hg/patches} directory is a repository, i.e.~you created the 20 \sdirname{.hg/patches} directory is a repository, i.e.~you created the
21 directory using \hgcmdargs{qinit}{\hgopt{qinit}{-c}} or ran 21 directory using \hgcmdargs{qinit}{\hgopt{qinit}{-c}} or ran
22 \hgcmd{init} in the directory after running \hgcmd{qinit}. 22 \hgcmd{init} in the directory after running \hgxcmd{mq}{qinit}.
23 23
24 This command is shorthand for \hgcmdargs{commit}{--cwd .hg/patches}. 24 This command is shorthand for \hgcmdargs{commit}{--cwd .hg/patches}.
25 25
26 \subsection{\hgcmd{qdelete}---delete a patch from the 26 \subsection{\hgxcmd{mq}{qdelete}---delete a patch from the
27 \sfilename{series} file} 27 \sfilename{series} file}
28 28
29 The \hgcmd{qdelete} command removes the entry for a patch from the 29 The \hgxcmd{mq}{qdelete} command removes the entry for a patch from the
30 \sfilename{series} file in the \sdirname{.hg/patches} directory. It 30 \sfilename{series} file in the \sdirname{.hg/patches} directory. It
31 does not pop the patch if the patch is already applied. By default, 31 does not pop the patch if the patch is already applied. By default,
32 it does not delete the patch file; use the \hgopt{qdel}{-f} option to 32 it does not delete the patch file; use the \hgopt{qdel}{-f} option to
33 do that. 33 do that.
34 34
35 Options: 35 Options:
36 \begin{itemize} 36 \begin{itemize}
37 \item[\hgopt{qdel}{-f}] Delete the patch file. 37 \item[\hgopt{qdel}{-f}] Delete the patch file.
38 \end{itemize} 38 \end{itemize}
39 39
40 \subsection{\hgcmd{qdiff}---print a diff of the topmost applied patch} 40 \subsection{\hgxcmd{mq}{qdiff}---print a diff of the topmost applied patch}
41 41
42 The \hgcmd{qdiff} command prints a diff of the topmost applied patch. 42 The \hgxcmd{mq}{qdiff} command prints a diff of the topmost applied patch.
43 It is equivalent to \hgcmdargs{diff}{-r-2:-1}. 43 It is equivalent to \hgcmdargs{diff}{-r-2:-1}.
44 44
45 \subsection{\hgcmd{qfold}---merge (``fold'') several patches into one} 45 \subsection{\hgxcmd{mq}{qfold}---merge (``fold'') several patches into one}
46 46
47 The \hgcmd{qfold} command merges multiple patches into the topmost 47 The \hgxcmd{mq}{qfold} command merges multiple patches into the topmost
48 applied patch, so that the topmost applied patch makes the union of 48 applied patch, so that the topmost applied patch makes the union of
49 all of the changes in the patches in question. 49 all of the changes in the patches in question.
50 50
51 The patches to fold must not be applied; \hgcmd{qfold} will exit with 51 The patches to fold must not be applied; \hgxcmd{mq}{qfold} will exit with
52 an error if any is. The order in which patches are folded is 52 an error if any is. The order in which patches are folded is
53 significant; \hgcmdargs{qfold}{a b} means ``apply the current topmost 53 significant; \hgcmdargs{qfold}{a b} means ``apply the current topmost
54 patch, followed by \texttt{a}, followed by \texttt{b}''. 54 patch, followed by \texttt{a}, followed by \texttt{b}''.
55 55
56 The comments from the folded patches are appended to the comments of 56 The comments from the folded patches are appended to the comments of
67 commit message and patch description for the folded patch. 67 commit message and patch description for the folded patch.
68 \item[\hgopt{qfold}{-m}] Use the given text as the new commit message 68 \item[\hgopt{qfold}{-m}] Use the given text as the new commit message
69 and patch description for the folded patch. 69 and patch description for the folded patch.
70 \end{itemize} 70 \end{itemize}
71 71
72 \subsection{\hgcmd{qheader}---display the header/description of a patch} 72 \subsection{\hgxcmd{mq}{qheader}---display the header/description of a patch}
73 73
74 The \hgcmd{qheader} command prints the header, or description, of a 74 The \hgxcmd{mq}{qheader} command prints the header, or description, of a
75 patch. By default, it prints the header of the topmost applied patch. 75 patch. By default, it prints the header of the topmost applied patch.
76 Given an argument, it prints the header of the named patch. 76 Given an argument, it prints the header of the named patch.
77 77
78 \subsection{\hgcmd{qimport}---import a third-party patch into the queue} 78 \subsection{\hgxcmd{mq}{qimport}---import a third-party patch into the queue}
79 79
80 The \hgcmd{qimport} command adds an entry for an external patch to the 80 The \hgxcmd{mq}{qimport} command adds an entry for an external patch to the
81 \sfilename{series} file, and copies the patch into the 81 \sfilename{series} file, and copies the patch into the
82 \sdirname{.hg/patches} directory. It adds the entry immediately after 82 \sdirname{.hg/patches} directory. It adds the entry immediately after
83 the topmost applied patch, but does not push the patch. 83 the topmost applied patch, but does not push the patch.
84 84
85 If the \sdirname{.hg/patches} directory is a repository, 85 If the \sdirname{.hg/patches} directory is a repository,
86 \hgcmd{qimport} automatically does an \hgcmd{add} of the imported 86 \hgxcmd{mq}{qimport} automatically does an \hgcmd{add} of the imported
87 patch. 87 patch.
88 88
89 \subsection{\hgcmd{qinit}---prepare a repository to work with MQ} 89 \subsection{\hgxcmd{mq}{qinit}---prepare a repository to work with MQ}
90 90
91 The \hgcmd{qinit} command prepares a repository to work with MQ. It 91 The \hgxcmd{mq}{qinit} command prepares a repository to work with MQ. It
92 creates a directory called \sdirname{.hg/patches}. 92 creates a directory called \sdirname{.hg/patches}.
93 93
94 Options: 94 Options:
95 \begin{itemize} 95 \begin{itemize}
96 \item[\hgopt{qinit}{-c}] Create \sdirname{.hg/patches} as a repository 96 \item[\hgopt{qinit}{-c}] Create \sdirname{.hg/patches} as a repository
97 in its own right. Also creates a \sfilename{.hgignore} file that 97 in its own right. Also creates a \sfilename{.hgignore} file that
98 will ignore the \sfilename{status} file. 98 will ignore the \sfilename{status} file.
99 \end{itemize} 99 \end{itemize}
100 100
101 When the \sdirname{.hg/patches} directory is a repository, the 101 When the \sdirname{.hg/patches} directory is a repository, the
102 \hgcmd{qimport} and \hgcmd{qnew} commands automatically \hgcmd{add} 102 \hgxcmd{mq}{qimport} and \hgxcmd{mq}{qnew} commands automatically \hgcmd{add}
103 new patches. 103 new patches.
104 104
105 \subsection{\hgcmd{qnew}---create a new patch} 105 \subsection{\hgxcmd{mq}{qnew}---create a new patch}
106 106
107 The \hgcmd{qnew} command creates a new patch. It takes one mandatory 107 The \hgxcmd{mq}{qnew} command creates a new patch. It takes one mandatory
108 argument, the name to use for the patch file. The newly created patch 108 argument, the name to use for the patch file. The newly created patch
109 is created empty by default. It is added to the \sfilename{series} 109 is created empty by default. It is added to the \sfilename{series}
110 file after the current topmost applied patch, and is immediately 110 file after the current topmost applied patch, and is immediately
111 pushed on top of that patch. 111 pushed on top of that patch.
112 112
113 If \hgcmd{qnew} finds modified files in the working directory, it will 113 If \hgxcmd{mq}{qnew} finds modified files in the working directory, it will
114 refuse to create a new patch unless the \hgopt{qnew}{-f} option is 114 refuse to create a new patch unless the \hgopt{qnew}{-f} option is
115 used (see below). This behaviour allows you to \hgcmd{qrefresh} your 115 used (see below). This behaviour allows you to \hgxcmd{mq}{qrefresh} your
116 topmost applied patch before you apply a new patch on top of it. 116 topmost applied patch before you apply a new patch on top of it.
117 117
118 Options: 118 Options:
119 \begin{itemize} 119 \begin{itemize}
120 \item[\hgopt{qnew}{-f}] Create a new patch if the contents of the 120 \item[\hgopt{qnew}{-f}] Create a new patch if the contents of the
124 \item[\hgopt{qnew}{-m}] Use the given text as the commit message. 124 \item[\hgopt{qnew}{-m}] Use the given text as the commit message.
125 This text will be stored at the beginning of the patch file, before 125 This text will be stored at the beginning of the patch file, before
126 the patch data. 126 the patch data.
127 \end{itemize} 127 \end{itemize}
128 128
129 \subsection{\hgcmd{qnext}---print the name of the next patch} 129 \subsection{\hgxcmd{mq}{qnext}---print the name of the next patch}
130 130
131 The \hgcmd{qnext} command prints the name name of the next patch in 131 The \hgxcmd{mq}{qnext} command prints the name name of the next patch in
132 the \sfilename{series} file after the topmost applied patch. This 132 the \sfilename{series} file after the topmost applied patch. This
133 patch will become the topmost applied patch if you run \hgcmd{qpush}. 133 patch will become the topmost applied patch if you run \hgxcmd{mq}{qpush}.
134 134
135 \subsection{\hgcmd{qpop}---pop patches off the stack} 135 \subsection{\hgxcmd{mq}{qpop}---pop patches off the stack}
136 136
137 The \hgcmd{qpop} command removes applied patches from the top of the 137 The \hgxcmd{mq}{qpop} command removes applied patches from the top of the
138 stack of applied patches. By default, it removes only one patch. 138 stack of applied patches. By default, it removes only one patch.
139 139
140 This command removes the changesets that represent the popped patches 140 This command removes the changesets that represent the popped patches
141 from the repository, and updates the working directory to undo the 141 from the repository, and updates the working directory to undo the
142 effects of the patches. 142 effects of the patches.
143 143
144 This command takes an optional argument, which it uses as the name or 144 This command takes an optional argument, which it uses as the name or
145 index of the patch to pop to. If given a name, it will pop patches 145 index of the patch to pop to. If given a name, it will pop patches
146 until the named patch is the topmost applied patch. If given a 146 until the named patch is the topmost applied patch. If given a
147 number, \hgcmd{qpop} treats the number as an index into the entries in 147 number, \hgxcmd{mq}{qpop} treats the number as an index into the entries in
148 the series file, counting from zero (empty lines and lines containing 148 the series file, counting from zero (empty lines and lines containing
149 only comments do not count). It pops patches until the patch 149 only comments do not count). It pops patches until the patch
150 identified by the given index is the topmost applied patch. 150 identified by the given index is the topmost applied patch.
151 151
152 The \hgcmd{qpop} command does not read or write patches or the 152 The \hgxcmd{mq}{qpop} command does not read or write patches or the
153 \sfilename{series} file. It is thus safe to \hgcmd{qpop} a patch that 153 \sfilename{series} file. It is thus safe to \hgxcmd{mq}{qpop} a patch that
154 you have removed from the \sfilename{series} file, or a patch that you 154 you have removed from the \sfilename{series} file, or a patch that you
155 have renamed or deleted entirely. In the latter two cases, use the 155 have renamed or deleted entirely. In the latter two cases, use the
156 name of the patch as it was when you applied it. 156 name of the patch as it was when you applied it.
157 157
158 By default, the \hgcmd{qpop} command will not pop any patches if the 158 By default, the \hgxcmd{mq}{qpop} command will not pop any patches if the
159 working directory has been modified. You can override this behaviour 159 working directory has been modified. You can override this behaviour
160 using the \hgopt{qpop}{-f} option, which reverts all modifications in 160 using the \hgopt{qpop}{-f} option, which reverts all modifications in
161 the working directory. 161 the working directory.
162 162
163 Options: 163 Options:
167 \item[\hgopt{qpop}{-f}] Forcibly revert any modifications to the 167 \item[\hgopt{qpop}{-f}] Forcibly revert any modifications to the
168 working directory when popping. 168 working directory when popping.
169 \item[\hgopt{qpop}{-n}] Pop a patch from the named queue. 169 \item[\hgopt{qpop}{-n}] Pop a patch from the named queue.
170 \end{itemize} 170 \end{itemize}
171 171
172 The \hgcmd{qpop} command removes one line from the end of the 172 The \hgxcmd{mq}{qpop} command removes one line from the end of the
173 \sfilename{status} file for each patch that it pops. 173 \sfilename{status} file for each patch that it pops.
174 174
175 \subsection{\hgcmd{qprev}---print the name of the previous patch} 175 \subsection{\hgxcmd{mq}{qprev}---print the name of the previous patch}
176 176
177 The \hgcmd{qprev} command prints the name of the patch in the 177 The \hgxcmd{mq}{qprev} command prints the name of the patch in the
178 \sfilename{series} file that comes before the topmost applied patch. 178 \sfilename{series} file that comes before the topmost applied patch.
179 This will become the topmost applied patch if you run \hgcmd{qpop}. 179 This will become the topmost applied patch if you run \hgxcmd{mq}{qpop}.
180 180
181 \subsection{\hgcmd{qpush}---push patches onto the stack} 181 \subsection{\hgxcmd{mq}{qpush}---push patches onto the stack}
182 \label{sec:mqref:cmd:qpush} 182 \label{sec:mqref:cmd:qpush}
183 183
184 The \hgcmd{qpush} command adds patches onto the applied stack. By 184 The \hgxcmd{mq}{qpush} command adds patches onto the applied stack. By
185 default, it adds only one patch. 185 default, it adds only one patch.
186 186
187 This command creates a new changeset to represent each applied patch, 187 This command creates a new changeset to represent each applied patch,
188 and updates the working directory to apply the effects of the patches. 188 and updates the working directory to apply the effects of the patches.
189 189
190 The default data used when creating a changeset are as follows: 190 The default data used when creating a changeset are as follows:
191 \begin{itemize} 191 \begin{itemize}
192 \item The commit date and time zone are the current date and time 192 \item The commit date and time zone are the current date and time
193 zone. Because these data are used to compute the identity of a 193 zone. Because these data are used to compute the identity of a
194 changeset, this means that if you \hgcmd{qpop} a patch and 194 changeset, this means that if you \hgxcmd{mq}{qpop} a patch and
195 \hgcmd{qpush} it again, the changeset that you push will have a 195 \hgxcmd{mq}{qpush} it again, the changeset that you push will have a
196 different identity than the changeset you popped. 196 different identity than the changeset you popped.
197 \item The author is the same as the default used by the \hgcmd{commit} 197 \item The author is the same as the default used by the \hgcmd{commit}
198 command. 198 command.
199 \item The commit message is any text from the patch file that comes 199 \item The commit message is any text from the patch file that comes
200 before the first diff header. If there is no such text, a default 200 before the first diff header. If there is no such text, a default
215 normal Mercurial merge machinery. Use the resolution of the merge 215 normal Mercurial merge machinery. Use the resolution of the merge
216 as the new patch content. 216 as the new patch content.
217 \item[\hgopt{qpush}{-n}] Use the named queue if merging while pushing. 217 \item[\hgopt{qpush}{-n}] Use the named queue if merging while pushing.
218 \end{itemize} 218 \end{itemize}
219 219
220 The \hgcmd{qpush} command reads, but does not modify, the 220 The \hgxcmd{mq}{qpush} command reads, but does not modify, the
221 \sfilename{series} file. It appends one line to the \hgcmd{status} 221 \sfilename{series} file. It appends one line to the \hgcmd{status}
222 file for each patch that it pushes. 222 file for each patch that it pushes.
223 223
224 \subsection{\hgcmd{qrefresh}---update the topmost applied patch} 224 \subsection{\hgxcmd{mq}{qrefresh}---update the topmost applied patch}
225 225
226 The \hgcmd{qrefresh} command updates the topmost applied patch. It 226 The \hgxcmd{mq}{qrefresh} command updates the topmost applied patch. It
227 modifies the patch, removes the old changeset that represented the 227 modifies the patch, removes the old changeset that represented the
228 patch, and creates a new changeset to represent the modified patch. 228 patch, and creates a new changeset to represent the modified patch.
229 229
230 The \hgcmd{qrefresh} command looks for the following modifications: 230 The \hgxcmd{mq}{qrefresh} command looks for the following modifications:
231 \begin{itemize} 231 \begin{itemize}
232 \item Changes to the commit message, i.e.~the text before the first 232 \item Changes to the commit message, i.e.~the text before the first
233 diff header in the patch file, are reflected in the new changeset 233 diff header in the patch file, are reflected in the new changeset
234 that represents the patch. 234 that represents the patch.
235 \item Modifications to tracked files in the working directory are 235 \item Modifications to tracked files in the working directory are
238 \hgcmd{remove}, or \hgcmd{rename}. Added files and copy and rename 238 \hgcmd{remove}, or \hgcmd{rename}. Added files and copy and rename
239 destinations are added to the patch, while removed files and rename 239 destinations are added to the patch, while removed files and rename
240 sources are removed. 240 sources are removed.
241 \end{itemize} 241 \end{itemize}
242 242
243 Even if \hgcmd{qrefresh} detects no changes, it still recreates the 243 Even if \hgxcmd{mq}{qrefresh} detects no changes, it still recreates the
244 changeset that represents the patch. This causes the identity of the 244 changeset that represents the patch. This causes the identity of the
245 changeset to differ from the previous changeset that identified the 245 changeset to differ from the previous changeset that identified the
246 patch. 246 patch.
247 247
248 Options: 248 Options:
253 description, using the given text. 253 description, using the given text.
254 \item[\hgopt{qrefresh}{-l}] Modify the commit message and patch 254 \item[\hgopt{qrefresh}{-l}] Modify the commit message and patch
255 description, using text from the given file. 255 description, using text from the given file.
256 \end{itemize} 256 \end{itemize}
257 257
258 \subsection{\hgcmd{qrename}---rename a patch} 258 \subsection{\hgxcmd{mq}{qrename}---rename a patch}
259 259
260 The \hgcmd{qrename} command renames a patch, and changes the entry for 260 The \hgxcmd{mq}{qrename} command renames a patch, and changes the entry for
261 the patch in the \sfilename{series} file. 261 the patch in the \sfilename{series} file.
262 262
263 With a single argument, \hgcmd{qrename} renames the topmost applied 263 With a single argument, \hgxcmd{mq}{qrename} renames the topmost applied
264 patch. With two arguments, it renames its first argument to its 264 patch. With two arguments, it renames its first argument to its
265 second. 265 second.
266 266
267 \subsection{\hgcmd{qrestore}---restore saved queue state} 267 \subsection{\hgxcmd{mq}{qrestore}---restore saved queue state}
268 268
269 XXX No idea what this does. 269 XXX No idea what this does.
270 270
271 \subsection{\hgcmd{qsave}---save current queue state} 271 \subsection{\hgxcmd{mq}{qsave}---save current queue state}
272 272
273 XXX Likewise. 273 XXX Likewise.
274 274
275 \subsection{\hgcmd{qseries}---print the entire patch series} 275 \subsection{\hgxcmd{mq}{qseries}---print the entire patch series}
276 276
277 The \hgcmd{qseries} command prints the entire patch series from the 277 The \hgxcmd{mq}{qseries} command prints the entire patch series from the
278 \sfilename{series} file. It prints only patch names, not empty lines 278 \sfilename{series} file. It prints only patch names, not empty lines
279 or comments. It prints in order from first to be applied to last. 279 or comments. It prints in order from first to be applied to last.
280 280
281 \subsection{\hgcmd{qtop}---print the name of the current patch} 281 \subsection{\hgxcmd{mq}{qtop}---print the name of the current patch}
282 282
283 The \hgcmd{qtop} prints the name of the topmost currently applied 283 The \hgxcmd{mq}{qtop} prints the name of the topmost currently applied
284 patch. 284 patch.
285 285
286 \subsection{\hgcmd{qunapplied}---print patches not yet applied} 286 \subsection{\hgxcmd{mq}{qunapplied}---print patches not yet applied}
287 287
288 The \hgcmd{qunapplied} command prints the names of patches from the 288 The \hgxcmd{mq}{qunapplied} command prints the names of patches from the
289 \sfilename{series} file that are not yet applied. It prints them in 289 \sfilename{series} file that are not yet applied. It prints them in
290 order from the next patch that will be pushed to the last. 290 order from the next patch that will be pushed to the last.
291 291
292 \subsection{\hgcmd{qversion}} 292 \subsection{\hgxcmd{mq}{qversion}}
293 293
294 The \hgcmd{qversion} command prints the version of MQ that is in use. 294 The \hgxcmd{mq}{qversion} command prints the version of MQ that is in use.
295 295
296 \subsection{\hgcmd{strip}---remove a revision and descendants} 296 \subsection{\hgcmd{strip}---remove a revision and descendants}
297 297
298 The \hgcmd{strip} command removes a revision, and all of its 298 The \hgcmd{strip} command removes a revision, and all of its
299 descendants, from the repository. It undoes the effects of the 299 descendants, from the repository. It undoes the effects of the
326 character, and extends to the end of the line. Empty lines, and lines 326 character, and extends to the end of the line. Empty lines, and lines
327 that contain only comments, are ignored. 327 that contain only comments, are ignored.
328 328
329 You will often need to edit the \sfilename{series} file by hand, hence 329 You will often need to edit the \sfilename{series} file by hand, hence
330 the support for comments and empty lines noted above. For example, 330 the support for comments and empty lines noted above. For example,
331 you can comment out a patch temporarily, and \hgcmd{qpush} will skip 331 you can comment out a patch temporarily, and \hgxcmd{mq}{qpush} will skip
332 over that patch when applying patches. You can also change the order 332 over that patch when applying patches. You can also change the order
333 in which patches are applied by reordering their entries in the 333 in which patches are applied by reordering their entries in the
334 \sfilename{series} file. 334 \sfilename{series} file.
335 335
336 Placing the \sfilename{series} file under revision control is also 336 Placing the \sfilename{series} file under revision control is also
337 supported; it is a good idea to place all of the patches that it 337 supported; it is a good idea to place all of the patches that it
338 refers to under revision control, as well. If you create a patch 338 refers to under revision control, as well. If you create a patch
339 directory using the \hgopt{qinit}{-c} option to \hgcmd{qinit}, this 339 directory using the \hgopt{qinit}{-c} option to \hgxcmd{mq}{qinit}, this
340 will be done for you automatically. 340 will be done for you automatically.
341 341
342 \subsection{The \sfilename{status} file} 342 \subsection{The \sfilename{status} file}
343 343
344 The \sfilename{status} file contains the names and changeset hashes of 344 The \sfilename{status} file contains the names and changeset hashes of