hgbook
diff en/mq-ref.tex @ 143:f2aabd15dd50
Fix another regexp.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue Mar 06 21:43:30 2007 -0800 (2007-03-06) |
parents | |
children | 34943a3d50d6 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/en/mq-ref.tex Tue Mar 06 21:43:30 2007 -0800 1.3 @@ -0,0 +1,352 @@ 1.4 +\chapter{Mercurial Queues reference} 1.5 + 1.6 +\section{MQ command reference} 1.7 +\label{sec:mq:cmdref} 1.8 + 1.9 +For an overview of the commands provided by MQ, use the command 1.10 +\hgcmdargs{help}{mq}. 1.11 + 1.12 +\subsection{\hgcmd{qapplied}---print applied patches} 1.13 + 1.14 +The \hgcmd{qapplied} command prints the current stack of applied 1.15 +patches. Patches are printed in oldest-to-newest order, so the last 1.16 +patch in the list is the ``top'' patch. 1.17 + 1.18 +\subsection{\hgcmd{qcommit}---commit changes in the queue repository} 1.19 + 1.20 +The \hgcmd{qcommit} command commits any outstanding changes in the 1.21 +\sdirname{.hg/patches} repository. This command only works if the 1.22 +\sdirname{.hg/patches} directory is a repository, i.e.~you created the 1.23 +directory using \hgcmdargs{qinit}{\hgopt{qinit}{-c}} or ran 1.24 +\hgcmd{init} in the directory after running \hgcmd{qinit}. 1.25 + 1.26 +This command is shorthand for \hgcmdargs{commit}{--cwd .hg/patches}. 1.27 + 1.28 +\subsection{\hgcmd{qdelete}---delete a patch from the 1.29 + \sfilename{series} file} 1.30 + 1.31 +The \hgcmd{qdelete} command removes the entry for a patch from the 1.32 +\sfilename{series} file in the \sdirname{.hg/patches} directory. It 1.33 +does not pop the patch if the patch is already applied. By default, 1.34 +it does not delete the patch file; use the \hgopt{qdel}{-f} option to 1.35 +do that. 1.36 + 1.37 +Options: 1.38 +\begin{itemize} 1.39 +\item[\hgopt{qdel}{-f}] Delete the patch file. 1.40 +\end{itemize} 1.41 + 1.42 +\subsection{\hgcmd{qdiff}---print a diff of the topmost applied patch} 1.43 + 1.44 +The \hgcmd{qdiff} command prints a diff of the topmost applied patch. 1.45 +It is equivalent to \hgcmdargs{diff}{-r-2:-1}. 1.46 + 1.47 +\subsection{\hgcmd{qfold}---merge (``fold'') several patches into one} 1.48 + 1.49 +The \hgcmd{qfold} command merges multiple patches into the topmost 1.50 +applied patch, so that the topmost applied patch makes the union of 1.51 +all of the changes in the patches in question. 1.52 + 1.53 +The patches to fold must not be applied; \hgcmd{qfold} will exit with 1.54 +an error if any is. The order in which patches are folded is 1.55 +significant; \hgcmdargs{qfold}{a b} means ``apply the current topmost 1.56 +patch, followed by \texttt{a}, followed by \texttt{b}''. 1.57 + 1.58 +The comments from the folded patches are appended to the comments of 1.59 +the destination patch, with each block of comments separated by three 1.60 +asterisk (``\texttt{*}'') characters. Use the \hgopt{qfold}{-e} 1.61 +option to edit the commit message for the combined patch/changeset 1.62 +after the folding has completed. 1.63 + 1.64 +Options: 1.65 +\begin{itemize} 1.66 +\item[\hgopt{qfold}{-e}] Edit the commit message and patch description 1.67 + for the newly folded patch. 1.68 +\item[\hgopt{qfold}{-l}] Use the contents of the given file as the new 1.69 + commit message and patch description for the folded patch. 1.70 +\item[\hgopt{qfold}{-m}] Use the given text as the new commit message 1.71 + and patch description for the folded patch. 1.72 +\end{itemize} 1.73 + 1.74 +\subsection{\hgcmd{qheader}---display the header/description of a patch} 1.75 + 1.76 +The \hgcmd{qheader} command prints the header, or description, of a 1.77 +patch. By default, it prints the header of the topmost applied patch. 1.78 +Given an argument, it prints the header of the named patch. 1.79 + 1.80 +\subsection{\hgcmd{qimport}---import a third-party patch into the queue} 1.81 + 1.82 +The \hgcmd{qimport} command adds an entry for an external patch to the 1.83 +\sfilename{series} file, and copies the patch into the 1.84 +\sdirname{.hg/patches} directory. It adds the entry immediately after 1.85 +the topmost applied patch, but does not push the patch. 1.86 + 1.87 +If the \sdirname{.hg/patches} directory is a repository, 1.88 +\hgcmd{qimport} automatically does an \hgcmd{add} of the imported 1.89 +patch. 1.90 + 1.91 +\subsection{\hgcmd{qinit}---prepare a repository to work with MQ} 1.92 + 1.93 +The \hgcmd{qinit} command prepares a repository to work with MQ. It 1.94 +creates a directory called \sdirname{.hg/patches}. 1.95 + 1.96 +Options: 1.97 +\begin{itemize} 1.98 +\item[\hgopt{qinit}{-c}] Create \sdirname{.hg/patches} as a repository 1.99 + in its own right. Also creates a \sfilename{.hgignore} file that 1.100 + will ignore the \sfilename{status} file. 1.101 +\end{itemize} 1.102 + 1.103 +When the \sdirname{.hg/patches} directory is a repository, the 1.104 +\hgcmd{qimport} and \hgcmd{qnew} commands automatically \hgcmd{add} 1.105 +new patches. 1.106 + 1.107 +\subsection{\hgcmd{qnew}---create a new patch} 1.108 + 1.109 +The \hgcmd{qnew} command creates a new patch. It takes one mandatory 1.110 +argument, the name to use for the patch file. The newly created patch 1.111 +is created empty by default. It is added to the \sfilename{series} 1.112 +file after the current topmost applied patch, and is immediately 1.113 +pushed on top of that patch. 1.114 + 1.115 +If \hgcmd{qnew} finds modified files in the working directory, it will 1.116 +refuse to create a new patch unless the \hgopt{qnew}{-f} option is 1.117 +used (see below). This behaviour allows you to \hgcmd{qrefresh} your 1.118 +topmost applied patch before you apply a new patch on top of it. 1.119 + 1.120 +Options: 1.121 +\begin{itemize} 1.122 +\item[\hgopt{qnew}{-f}] Create a new patch if the contents of the 1.123 + working directory are modified. Any outstanding modifications are 1.124 + added to the newly created patch, so after this command completes, 1.125 + the working directory will no longer be modified. 1.126 +\item[\hgopt{qnew}{-m}] Use the given text as the commit message. 1.127 + This text will be stored at the beginning of the patch file, before 1.128 + the patch data. 1.129 +\end{itemize} 1.130 + 1.131 +\subsection{\hgcmd{qnext}---print the name of the next patch} 1.132 + 1.133 +The \hgcmd{qnext} command prints the name name of the next patch in 1.134 +the \sfilename{series} file after the topmost applied patch. This 1.135 +patch will become the topmost applied patch if you run \hgcmd{qpush}. 1.136 + 1.137 +\subsection{\hgcmd{qpop}---pop patches off the stack} 1.138 + 1.139 +The \hgcmd{qpop} command removes applied patches from the top of the 1.140 +stack of applied patches. By default, it removes only one patch. 1.141 + 1.142 +This command removes the changesets that represent the popped patches 1.143 +from the repository, and updates the working directory to undo the 1.144 +effects of the patches. 1.145 + 1.146 +This command takes an optional argument, which it uses as the name or 1.147 +index of the patch to pop to. If given a name, it will pop patches 1.148 +until the named patch is the topmost applied patch. If given a 1.149 +number, \hgcmd{qpop} treats the number as an index into the entries in 1.150 +the series file, counting from zero (empty lines and lines containing 1.151 +only comments do not count). It pops patches until the patch 1.152 +identified by the given index is the topmost applied patch. 1.153 + 1.154 +The \hgcmd{qpop} command does not read or write patches or the 1.155 +\sfilename{series} file. It is thus safe to \hgcmd{qpop} a patch that 1.156 +you have removed from the \sfilename{series} file, or a patch that you 1.157 +have renamed or deleted entirely. In the latter two cases, use the 1.158 +name of the patch as it was when you applied it. 1.159 + 1.160 +By default, the \hgcmd{qpop} command will not pop any patches if the 1.161 +working directory has been modified. You can override this behaviour 1.162 +using the \hgopt{qpop}{-f} option, which reverts all modifications in 1.163 +the working directory. 1.164 + 1.165 +Options: 1.166 +\begin{itemize} 1.167 +\item[\hgopt{qpop}{-a}] Pop all applied patches. This returns the 1.168 + repository to its state before you applied any patches. 1.169 +\item[\hgopt{qpop}{-f}] Forcibly revert any modifications to the 1.170 + working directory when popping. 1.171 +\item[\hgopt{qpop}{-n}] Pop a patch from the named queue. 1.172 +\end{itemize} 1.173 + 1.174 +The \hgcmd{qpop} command removes one line from the end of the 1.175 +\sfilename{status} file for each patch that it pops. 1.176 + 1.177 +\subsection{\hgcmd{qprev}---print the name of the previous patch} 1.178 + 1.179 +The \hgcmd{qprev} command prints the name of the patch in the 1.180 +\sfilename{series} file that comes before the topmost applied patch. 1.181 +This will become the topmost applied patch if you run \hgcmd{qpop}. 1.182 + 1.183 +\subsection{\hgcmd{qpush}---push patches onto the stack} 1.184 +\label{sec:mq:cmd:qpush} 1.185 + 1.186 +The \hgcmd{qpush} command adds patches onto the applied stack. By 1.187 +default, it adds only one patch. 1.188 + 1.189 +This command creates a new changeset to represent each applied patch, 1.190 +and updates the working directory to apply the effects of the patches. 1.191 + 1.192 +The default data used when creating a changeset are as follows: 1.193 +\begin{itemize} 1.194 +\item The commit date and time zone are the current date and time 1.195 + zone. Because these data are used to compute the identity of a 1.196 + changeset, this means that if you \hgcmd{qpop} a patch and 1.197 + \hgcmd{qpush} it again, the changeset that you push will have a 1.198 + different identity than the changeset you popped. 1.199 +\item The author is the same as the default used by the \hgcmd{commit} 1.200 + command. 1.201 +\item The commit message is any text from the patch file that comes 1.202 + before the first diff header. If there is no such text, a default 1.203 + commit message is used that identifies the name of the patch. 1.204 +\end{itemize} 1.205 +If a patch contains a Mercurial patch header (XXX add link), the 1.206 +information in the patch header overrides these defaults. 1.207 + 1.208 +Options: 1.209 +\begin{itemize} 1.210 +\item[\hgopt{qpush}{-a}] Push all unapplied patches from the 1.211 + \sfilename{series} file until there are none left to push. 1.212 +\item[\hgopt{qpush}{-l}] Add the name of the patch to the end 1.213 + of the commit message. 1.214 +\item[\hgopt{qpush}{-m}] If a patch fails to apply cleanly, use the 1.215 + entry for the patch in another saved queue to compute the parameters 1.216 + for a three-way merge, and perform a three-way merge using the 1.217 + normal Mercurial merge machinery. Use the resolution of the merge 1.218 + as the new patch content. 1.219 +\item[\hgopt{qpush}{-n}] Use the named queue if merging while pushing. 1.220 +\end{itemize} 1.221 + 1.222 +The \hgcmd{qpush} command reads, but does not modify, the 1.223 +\sfilename{series} file. It appends one line to the \hgcmd{status} 1.224 +file for each patch that it pushes. 1.225 + 1.226 +\subsection{\hgcmd{qrefresh}---update the topmost applied patch} 1.227 + 1.228 +The \hgcmd{qrefresh} command updates the topmost applied patch. It 1.229 +modifies the patch, removes the old changeset that represented the 1.230 +patch, and creates a new changeset to represent the modified patch. 1.231 + 1.232 +The \hgcmd{qrefresh} command looks for the following modifications: 1.233 +\begin{itemize} 1.234 +\item Changes to the commit message, i.e.~the text before the first 1.235 + diff header in the patch file, are reflected in the new changeset 1.236 + that represents the patch. 1.237 +\item Modifications to tracked files in the working directory are 1.238 + added to the patch. 1.239 +\item Changes to the files tracked using \hgcmd{add}, \hgcmd{copy}, 1.240 + \hgcmd{remove}, or \hgcmd{rename}. Added files and copy and rename 1.241 + destinations are added to the patch, while removed files and rename 1.242 + sources are removed. 1.243 +\end{itemize} 1.244 + 1.245 +Even if \hgcmd{qrefresh} detects no changes, it still recreates the 1.246 +changeset that represents the patch. This causes the identity of the 1.247 +changeset to differ from the previous changeset that identified the 1.248 +patch. 1.249 + 1.250 +Options: 1.251 +\begin{itemize} 1.252 +\item[\hgopt{qrefresh}{-e}] Modify the commit and patch description, 1.253 + using the preferred text editor. 1.254 +\item[\hgopt{qrefresh}{-m}] Modify the commit message and patch 1.255 + description, using the given text. 1.256 +\item[\hgopt{qrefresh}{-l}] Modify the commit message and patch 1.257 + description, using text from the given file. 1.258 +\end{itemize} 1.259 + 1.260 +\subsection{\hgcmd{qrename}---rename a patch} 1.261 + 1.262 +The \hgcmd{qrename} command renames a patch, and changes the entry for 1.263 +the patch in the \sfilename{series} file. 1.264 + 1.265 +With a single argument, \hgcmd{qrename} renames the topmost applied 1.266 +patch. With two arguments, it renames its first argument to its 1.267 +second. 1.268 + 1.269 +\subsection{\hgcmd{qrestore}---restore saved queue state} 1.270 + 1.271 +XXX No idea what this does. 1.272 + 1.273 +\subsection{\hgcmd{qsave}---save current queue state} 1.274 + 1.275 +XXX Likewise. 1.276 + 1.277 +\subsection{\hgcmd{qseries}---print the entire patch series} 1.278 + 1.279 +The \hgcmd{qseries} command prints the entire patch series from the 1.280 +\sfilename{series} file. It prints only patch names, not empty lines 1.281 +or comments. It prints in order from first to be applied to last. 1.282 + 1.283 +\subsection{\hgcmd{qtop}---print the name of the current patch} 1.284 + 1.285 +The \hgcmd{qtop} prints the name of the topmost currently applied 1.286 +patch. 1.287 + 1.288 +\subsection{\hgcmd{qunapplied}---print patches not yet applied} 1.289 + 1.290 +The \hgcmd{qunapplied} command prints the names of patches from the 1.291 +\sfilename{series} file that are not yet applied. It prints them in 1.292 +order from the next patch that will be pushed to the last. 1.293 + 1.294 +\subsection{\hgcmd{qversion}} 1.295 + 1.296 +The \hgcmd{qversion} command prints the version of MQ that is in use. 1.297 + 1.298 +\subsection{\hgcmd{strip}---remove a revision and descendants} 1.299 + 1.300 +The \hgcmd{strip} command removes a revision, and all of its 1.301 +descendants, from the repository. It undoes the effects of the 1.302 +removed revisions from the repository, and updates the working 1.303 +directory to the first parent of the removed revision. 1.304 + 1.305 +The \hgcmd{strip} command saves a backup of the removed changesets in 1.306 +a bundle, so that they can be reapplied if removed in error. 1.307 + 1.308 +Options: 1.309 +\begin{itemize} 1.310 +\item[\hgopt{strip}{-b}] Save unrelated changesets that are intermixed 1.311 + with the stripped changesets in the backup bundle. 1.312 +\item[\hgopt{strip}{-f}] If a branch has multiple heads, remove all 1.313 + heads. XXX This should be renamed, and use \texttt{-f} to strip revs 1.314 + when there are pending changes. 1.315 +\item[\hgopt{strip}{-n}] Do not save a backup bundle. 1.316 +\end{itemize} 1.317 + 1.318 +\section{MQ file reference} 1.319 + 1.320 +\subsection{The \sfilename{series} file} 1.321 + 1.322 +The \sfilename{series} file contains a list of the names of all 1.323 +patches that MQ can apply. It is represented as a list of names, with 1.324 +one name saved per line. Leading and trailing white space in each 1.325 +line are ignored. 1.326 + 1.327 +Lines may contain comments. A comment begins with the ``\texttt{\#}'' 1.328 +character, and extends to the end of the line. Empty lines, and lines 1.329 +that contain only comments, are ignored. 1.330 + 1.331 +You will often need to edit the \sfilename{series} file by hand, hence 1.332 +the support for comments and empty lines noted above. For example, 1.333 +you can comment out a patch temporarily, and \hgcmd{qpush} will skip 1.334 +over that patch when applying patches. You can also change the order 1.335 +in which patches are applied by reordering their entries in the 1.336 +\sfilename{series} file. 1.337 + 1.338 +Placing the \sfilename{series} file under revision control is also 1.339 +supported; it is a good idea to place all of the patches that it 1.340 +refers to under revision control, as well. If you create a patch 1.341 +directory using the \hgopt{qinit}{-c} option to \hgcmd{qinit}, this 1.342 +will be done for you automatically. 1.343 + 1.344 +\subsection{The \sfilename{status} file} 1.345 + 1.346 +The \sfilename{status} file contains the names and changeset hashes of 1.347 +all patches that MQ currently has applied. Unlike the 1.348 +\sfilename{series} file, this file is not intended for editing. You 1.349 +should not place this file under revision control, or modify it in any 1.350 +way. It is used by MQ strictly for internal book-keeping. 1.351 + 1.352 +%%% Local Variables: 1.353 +%%% mode: latex 1.354 +%%% TeX-master: "00book" 1.355 +%%% End: