hgbook

annotate es/mq-ref.tex @ 364:932c10e8c225

now, this has section 1.5 finished. Last commit had 1.4. Typo in commit message
author Javier Rojas <jerojasro@devnull.li>
date Sat Oct 25 15:41:52 2008 -0500 (2008-10-25)
parents 04c08ad7e92e
children f8614aad2cbb
rev   line source
jerojasro@336 1 \chapter{Mercurial Queues reference}
jerojasro@336 2 \label{chap:mqref}
jerojasro@336 3
jerojasro@336 4 \section{MQ command reference}
jerojasro@336 5 \label{sec:mqref:cmdref}
jerojasro@336 6
jerojasro@336 7 For an overview of the commands provided by MQ, use the command
jerojasro@336 8 \hgcmdargs{help}{mq}.
jerojasro@336 9
jerojasro@336 10 \subsection{\hgxcmd{mq}{qapplied}---print applied patches}
jerojasro@336 11
jerojasro@336 12 The \hgxcmd{mq}{qapplied} command prints the current stack of applied
jerojasro@336 13 patches. Patches are printed in oldest-to-newest order, so the last
jerojasro@336 14 patch in the list is the ``top'' patch.
jerojasro@336 15
jerojasro@336 16 \subsection{\hgxcmd{mq}{qcommit}---commit changes in the queue repository}
jerojasro@336 17
jerojasro@336 18 The \hgxcmd{mq}{qcommit} command commits any outstanding changes in the
jerojasro@336 19 \sdirname{.hg/patches} repository. This command only works if the
jerojasro@336 20 \sdirname{.hg/patches} directory is a repository, i.e.~you created the
jerojasro@336 21 directory using \hgcmdargs{qinit}{\hgxopt{mq}{qinit}{-c}} or ran
jerojasro@336 22 \hgcmd{init} in the directory after running \hgxcmd{mq}{qinit}.
jerojasro@336 23
jerojasro@336 24 This command is shorthand for \hgcmdargs{commit}{--cwd .hg/patches}.
jerojasro@336 25
jerojasro@336 26 \subsection{\hgxcmd{mq}{qdelete}---delete a patch from the
jerojasro@336 27 \sfilename{series} file}
jerojasro@336 28
jerojasro@336 29 The \hgxcmd{mq}{qdelete} command removes the entry for a patch from the
jerojasro@336 30 \sfilename{series} file in the \sdirname{.hg/patches} directory. It
jerojasro@336 31 does not pop the patch if the patch is already applied. By default,
jerojasro@336 32 it does not delete the patch file; use the \hgxopt{mq}{qdel}{-f} option to
jerojasro@336 33 do that.
jerojasro@336 34
jerojasro@336 35 Options:
jerojasro@336 36 \begin{itemize}
jerojasro@336 37 \item[\hgxopt{mq}{qdel}{-f}] Delete the patch file.
jerojasro@336 38 \end{itemize}
jerojasro@336 39
jerojasro@336 40 \subsection{\hgxcmd{mq}{qdiff}---print a diff of the topmost applied patch}
jerojasro@336 41
jerojasro@336 42 The \hgxcmd{mq}{qdiff} command prints a diff of the topmost applied patch.
jerojasro@336 43 It is equivalent to \hgcmdargs{diff}{-r-2:-1}.
jerojasro@336 44
jerojasro@336 45 \subsection{\hgxcmd{mq}{qfold}---merge (``fold'') several patches into one}
jerojasro@336 46
jerojasro@336 47 The \hgxcmd{mq}{qfold} command merges multiple patches into the topmost
jerojasro@336 48 applied patch, so that the topmost applied patch makes the union of
jerojasro@336 49 all of the changes in the patches in question.
jerojasro@336 50
jerojasro@336 51 The patches to fold must not be applied; \hgxcmd{mq}{qfold} will exit with
jerojasro@336 52 an error if any is. The order in which patches are folded is
jerojasro@336 53 significant; \hgcmdargs{qfold}{a b} means ``apply the current topmost
jerojasro@336 54 patch, followed by \texttt{a}, followed by \texttt{b}''.
jerojasro@336 55
jerojasro@336 56 The comments from the folded patches are appended to the comments of
jerojasro@336 57 the destination patch, with each block of comments separated by three
jerojasro@336 58 asterisk (``\texttt{*}'') characters. Use the \hgxopt{mq}{qfold}{-e}
jerojasro@336 59 option to edit the commit message for the combined patch/changeset
jerojasro@336 60 after the folding has completed.
jerojasro@336 61
jerojasro@336 62 Options:
jerojasro@336 63 \begin{itemize}
jerojasro@336 64 \item[\hgxopt{mq}{qfold}{-e}] Edit the commit message and patch description
jerojasro@336 65 for the newly folded patch.
jerojasro@336 66 \item[\hgxopt{mq}{qfold}{-l}] Use the contents of the given file as the new
jerojasro@336 67 commit message and patch description for the folded patch.
jerojasro@336 68 \item[\hgxopt{mq}{qfold}{-m}] Use the given text as the new commit message
jerojasro@336 69 and patch description for the folded patch.
jerojasro@336 70 \end{itemize}
jerojasro@336 71
jerojasro@336 72 \subsection{\hgxcmd{mq}{qheader}---display the header/description of a patch}
jerojasro@336 73
jerojasro@336 74 The \hgxcmd{mq}{qheader} command prints the header, or description, of a
jerojasro@336 75 patch. By default, it prints the header of the topmost applied patch.
jerojasro@336 76 Given an argument, it prints the header of the named patch.
jerojasro@336 77
jerojasro@336 78 \subsection{\hgxcmd{mq}{qimport}---import a third-party patch into the queue}
jerojasro@336 79
jerojasro@336 80 The \hgxcmd{mq}{qimport} command adds an entry for an external patch to the
jerojasro@336 81 \sfilename{series} file, and copies the patch into the
jerojasro@336 82 \sdirname{.hg/patches} directory. It adds the entry immediately after
jerojasro@336 83 the topmost applied patch, but does not push the patch.
jerojasro@336 84
jerojasro@336 85 If the \sdirname{.hg/patches} directory is a repository,
jerojasro@336 86 \hgxcmd{mq}{qimport} automatically does an \hgcmd{add} of the imported
jerojasro@336 87 patch.
jerojasro@336 88
jerojasro@336 89 \subsection{\hgxcmd{mq}{qinit}---prepare a repository to work with MQ}
jerojasro@336 90
jerojasro@336 91 The \hgxcmd{mq}{qinit} command prepares a repository to work with MQ. It
jerojasro@336 92 creates a directory called \sdirname{.hg/patches}.
jerojasro@336 93
jerojasro@336 94 Options:
jerojasro@336 95 \begin{itemize}
jerojasro@336 96 \item[\hgxopt{mq}{qinit}{-c}] Create \sdirname{.hg/patches} as a repository
jerojasro@336 97 in its own right. Also creates a \sfilename{.hgignore} file that
jerojasro@336 98 will ignore the \sfilename{status} file.
jerojasro@336 99 \end{itemize}
jerojasro@336 100
jerojasro@336 101 When the \sdirname{.hg/patches} directory is a repository, the
jerojasro@336 102 \hgxcmd{mq}{qimport} and \hgxcmd{mq}{qnew} commands automatically \hgcmd{add}
jerojasro@336 103 new patches.
jerojasro@336 104
jerojasro@336 105 \subsection{\hgxcmd{mq}{qnew}---create a new patch}
jerojasro@336 106
jerojasro@336 107 The \hgxcmd{mq}{qnew} command creates a new patch. It takes one mandatory
jerojasro@336 108 argument, the name to use for the patch file. The newly created patch
jerojasro@336 109 is created empty by default. It is added to the \sfilename{series}
jerojasro@336 110 file after the current topmost applied patch, and is immediately
jerojasro@336 111 pushed on top of that patch.
jerojasro@336 112
jerojasro@336 113 If \hgxcmd{mq}{qnew} finds modified files in the working directory, it will
jerojasro@336 114 refuse to create a new patch unless the \hgxopt{mq}{qnew}{-f} option is
jerojasro@336 115 used (see below). This behaviour allows you to \hgxcmd{mq}{qrefresh} your
jerojasro@336 116 topmost applied patch before you apply a new patch on top of it.
jerojasro@336 117
jerojasro@336 118 Options:
jerojasro@336 119 \begin{itemize}
jerojasro@336 120 \item[\hgxopt{mq}{qnew}{-f}] Create a new patch if the contents of the
jerojasro@336 121 working directory are modified. Any outstanding modifications are
jerojasro@336 122 added to the newly created patch, so after this command completes,
jerojasro@336 123 the working directory will no longer be modified.
jerojasro@336 124 \item[\hgxopt{mq}{qnew}{-m}] Use the given text as the commit message.
jerojasro@336 125 This text will be stored at the beginning of the patch file, before
jerojasro@336 126 the patch data.
jerojasro@336 127 \end{itemize}
jerojasro@336 128
jerojasro@336 129 \subsection{\hgxcmd{mq}{qnext}---print the name of the next patch}
jerojasro@336 130
jerojasro@336 131 The \hgxcmd{mq}{qnext} command prints the name name of the next patch in
jerojasro@336 132 the \sfilename{series} file after the topmost applied patch. This
jerojasro@336 133 patch will become the topmost applied patch if you run \hgxcmd{mq}{qpush}.
jerojasro@336 134
jerojasro@336 135 \subsection{\hgxcmd{mq}{qpop}---pop patches off the stack}
jerojasro@336 136
jerojasro@336 137 The \hgxcmd{mq}{qpop} command removes applied patches from the top of the
jerojasro@336 138 stack of applied patches. By default, it removes only one patch.
jerojasro@336 139
jerojasro@336 140 This command removes the changesets that represent the popped patches
jerojasro@336 141 from the repository, and updates the working directory to undo the
jerojasro@336 142 effects of the patches.
jerojasro@336 143
jerojasro@336 144 This command takes an optional argument, which it uses as the name or
jerojasro@336 145 index of the patch to pop to. If given a name, it will pop patches
jerojasro@336 146 until the named patch is the topmost applied patch. If given a
jerojasro@336 147 number, \hgxcmd{mq}{qpop} treats the number as an index into the entries in
jerojasro@336 148 the series file, counting from zero (empty lines and lines containing
jerojasro@336 149 only comments do not count). It pops patches until the patch
jerojasro@336 150 identified by the given index is the topmost applied patch.
jerojasro@336 151
jerojasro@336 152 The \hgxcmd{mq}{qpop} command does not read or write patches or the
jerojasro@336 153 \sfilename{series} file. It is thus safe to \hgxcmd{mq}{qpop} a patch that
jerojasro@336 154 you have removed from the \sfilename{series} file, or a patch that you
jerojasro@336 155 have renamed or deleted entirely. In the latter two cases, use the
jerojasro@336 156 name of the patch as it was when you applied it.
jerojasro@336 157
jerojasro@336 158 By default, the \hgxcmd{mq}{qpop} command will not pop any patches if the
jerojasro@336 159 working directory has been modified. You can override this behaviour
jerojasro@336 160 using the \hgxopt{mq}{qpop}{-f} option, which reverts all modifications in
jerojasro@336 161 the working directory.
jerojasro@336 162
jerojasro@336 163 Options:
jerojasro@336 164 \begin{itemize}
jerojasro@336 165 \item[\hgxopt{mq}{qpop}{-a}] Pop all applied patches. This returns the
jerojasro@336 166 repository to its state before you applied any patches.
jerojasro@336 167 \item[\hgxopt{mq}{qpop}{-f}] Forcibly revert any modifications to the
jerojasro@336 168 working directory when popping.
jerojasro@336 169 \item[\hgxopt{mq}{qpop}{-n}] Pop a patch from the named queue.
jerojasro@336 170 \end{itemize}
jerojasro@336 171
jerojasro@336 172 The \hgxcmd{mq}{qpop} command removes one line from the end of the
jerojasro@336 173 \sfilename{status} file for each patch that it pops.
jerojasro@336 174
jerojasro@336 175 \subsection{\hgxcmd{mq}{qprev}---print the name of the previous patch}
jerojasro@336 176
jerojasro@336 177 The \hgxcmd{mq}{qprev} command prints the name of the patch in the
jerojasro@336 178 \sfilename{series} file that comes before the topmost applied patch.
jerojasro@336 179 This will become the topmost applied patch if you run \hgxcmd{mq}{qpop}.
jerojasro@336 180
jerojasro@336 181 \subsection{\hgxcmd{mq}{qpush}---push patches onto the stack}
jerojasro@336 182 \label{sec:mqref:cmd:qpush}
jerojasro@336 183
jerojasro@336 184 The \hgxcmd{mq}{qpush} command adds patches onto the applied stack. By
jerojasro@336 185 default, it adds only one patch.
jerojasro@336 186
jerojasro@336 187 This command creates a new changeset to represent each applied patch,
jerojasro@336 188 and updates the working directory to apply the effects of the patches.
jerojasro@336 189
jerojasro@336 190 The default data used when creating a changeset are as follows:
jerojasro@336 191 \begin{itemize}
jerojasro@336 192 \item The commit date and time zone are the current date and time
jerojasro@336 193 zone. Because these data are used to compute the identity of a
jerojasro@336 194 changeset, this means that if you \hgxcmd{mq}{qpop} a patch and
jerojasro@336 195 \hgxcmd{mq}{qpush} it again, the changeset that you push will have a
jerojasro@336 196 different identity than the changeset you popped.
jerojasro@336 197 \item The author is the same as the default used by the \hgcmd{commit}
jerojasro@336 198 command.
jerojasro@336 199 \item The commit message is any text from the patch file that comes
jerojasro@336 200 before the first diff header. If there is no such text, a default
jerojasro@336 201 commit message is used that identifies the name of the patch.
jerojasro@336 202 \end{itemize}
jerojasro@336 203 If a patch contains a Mercurial patch header (XXX add link), the
jerojasro@336 204 information in the patch header overrides these defaults.
jerojasro@336 205
jerojasro@336 206 Options:
jerojasro@336 207 \begin{itemize}
jerojasro@336 208 \item[\hgxopt{mq}{qpush}{-a}] Push all unapplied patches from the
jerojasro@336 209 \sfilename{series} file until there are none left to push.
jerojasro@336 210 \item[\hgxopt{mq}{qpush}{-l}] Add the name of the patch to the end
jerojasro@336 211 of the commit message.
jerojasro@336 212 \item[\hgxopt{mq}{qpush}{-m}] If a patch fails to apply cleanly, use the
jerojasro@336 213 entry for the patch in another saved queue to compute the parameters
jerojasro@336 214 for a three-way merge, and perform a three-way merge using the
jerojasro@336 215 normal Mercurial merge machinery. Use the resolution of the merge
jerojasro@336 216 as the new patch content.
jerojasro@336 217 \item[\hgxopt{mq}{qpush}{-n}] Use the named queue if merging while pushing.
jerojasro@336 218 \end{itemize}
jerojasro@336 219
jerojasro@336 220 The \hgxcmd{mq}{qpush} command reads, but does not modify, the
jerojasro@336 221 \sfilename{series} file. It appends one line to the \hgcmd{status}
jerojasro@336 222 file for each patch that it pushes.
jerojasro@336 223
jerojasro@336 224 \subsection{\hgxcmd{mq}{qrefresh}---update the topmost applied patch}
jerojasro@336 225
jerojasro@336 226 The \hgxcmd{mq}{qrefresh} command updates the topmost applied patch. It
jerojasro@336 227 modifies the patch, removes the old changeset that represented the
jerojasro@336 228 patch, and creates a new changeset to represent the modified patch.
jerojasro@336 229
jerojasro@336 230 The \hgxcmd{mq}{qrefresh} command looks for the following modifications:
jerojasro@336 231 \begin{itemize}
jerojasro@336 232 \item Changes to the commit message, i.e.~the text before the first
jerojasro@336 233 diff header in the patch file, are reflected in the new changeset
jerojasro@336 234 that represents the patch.
jerojasro@336 235 \item Modifications to tracked files in the working directory are
jerojasro@336 236 added to the patch.
jerojasro@336 237 \item Changes to the files tracked using \hgcmd{add}, \hgcmd{copy},
jerojasro@336 238 \hgcmd{remove}, or \hgcmd{rename}. Added files and copy and rename
jerojasro@336 239 destinations are added to the patch, while removed files and rename
jerojasro@336 240 sources are removed.
jerojasro@336 241 \end{itemize}
jerojasro@336 242
jerojasro@336 243 Even if \hgxcmd{mq}{qrefresh} detects no changes, it still recreates the
jerojasro@336 244 changeset that represents the patch. This causes the identity of the
jerojasro@336 245 changeset to differ from the previous changeset that identified the
jerojasro@336 246 patch.
jerojasro@336 247
jerojasro@336 248 Options:
jerojasro@336 249 \begin{itemize}
jerojasro@336 250 \item[\hgxopt{mq}{qrefresh}{-e}] Modify the commit and patch description,
jerojasro@336 251 using the preferred text editor.
jerojasro@336 252 \item[\hgxopt{mq}{qrefresh}{-m}] Modify the commit message and patch
jerojasro@336 253 description, using the given text.
jerojasro@336 254 \item[\hgxopt{mq}{qrefresh}{-l}] Modify the commit message and patch
jerojasro@336 255 description, using text from the given file.
jerojasro@336 256 \end{itemize}
jerojasro@336 257
jerojasro@336 258 \subsection{\hgxcmd{mq}{qrename}---rename a patch}
jerojasro@336 259
jerojasro@336 260 The \hgxcmd{mq}{qrename} command renames a patch, and changes the entry for
jerojasro@336 261 the patch in the \sfilename{series} file.
jerojasro@336 262
jerojasro@336 263 With a single argument, \hgxcmd{mq}{qrename} renames the topmost applied
jerojasro@336 264 patch. With two arguments, it renames its first argument to its
jerojasro@336 265 second.
jerojasro@336 266
jerojasro@336 267 \subsection{\hgxcmd{mq}{qrestore}---restore saved queue state}
jerojasro@336 268
jerojasro@336 269 XXX No idea what this does.
jerojasro@336 270
jerojasro@336 271 \subsection{\hgxcmd{mq}{qsave}---save current queue state}
jerojasro@336 272
jerojasro@336 273 XXX Likewise.
jerojasro@336 274
jerojasro@336 275 \subsection{\hgxcmd{mq}{qseries}---print the entire patch series}
jerojasro@336 276
jerojasro@336 277 The \hgxcmd{mq}{qseries} command prints the entire patch series from the
jerojasro@336 278 \sfilename{series} file. It prints only patch names, not empty lines
jerojasro@336 279 or comments. It prints in order from first to be applied to last.
jerojasro@336 280
jerojasro@336 281 \subsection{\hgxcmd{mq}{qtop}---print the name of the current patch}
jerojasro@336 282
jerojasro@336 283 The \hgxcmd{mq}{qtop} prints the name of the topmost currently applied
jerojasro@336 284 patch.
jerojasro@336 285
jerojasro@336 286 \subsection{\hgxcmd{mq}{qunapplied}---print patches not yet applied}
jerojasro@336 287
jerojasro@336 288 The \hgxcmd{mq}{qunapplied} command prints the names of patches from the
jerojasro@336 289 \sfilename{series} file that are not yet applied. It prints them in
jerojasro@336 290 order from the next patch that will be pushed to the last.
jerojasro@336 291
jerojasro@336 292 \subsection{\hgcmd{strip}---remove a revision and descendants}
jerojasro@336 293
jerojasro@336 294 The \hgcmd{strip} command removes a revision, and all of its
jerojasro@336 295 descendants, from the repository. It undoes the effects of the
jerojasro@336 296 removed revisions from the repository, and updates the working
jerojasro@336 297 directory to the first parent of the removed revision.
jerojasro@336 298
jerojasro@336 299 The \hgcmd{strip} command saves a backup of the removed changesets in
jerojasro@336 300 a bundle, so that they can be reapplied if removed in error.
jerojasro@336 301
jerojasro@336 302 Options:
jerojasro@336 303 \begin{itemize}
jerojasro@336 304 \item[\hgopt{strip}{-b}] Save unrelated changesets that are intermixed
jerojasro@336 305 with the stripped changesets in the backup bundle.
jerojasro@336 306 \item[\hgopt{strip}{-f}] If a branch has multiple heads, remove all
jerojasro@336 307 heads. XXX This should be renamed, and use \texttt{-f} to strip revs
jerojasro@336 308 when there are pending changes.
jerojasro@336 309 \item[\hgopt{strip}{-n}] Do not save a backup bundle.
jerojasro@336 310 \end{itemize}
jerojasro@336 311
jerojasro@336 312 \section{MQ file reference}
jerojasro@336 313
jerojasro@336 314 \subsection{The \sfilename{series} file}
jerojasro@336 315
jerojasro@336 316 The \sfilename{series} file contains a list of the names of all
jerojasro@336 317 patches that MQ can apply. It is represented as a list of names, with
jerojasro@336 318 one name saved per line. Leading and trailing white space in each
jerojasro@336 319 line are ignored.
jerojasro@336 320
jerojasro@336 321 Lines may contain comments. A comment begins with the ``\texttt{\#}''
jerojasro@336 322 character, and extends to the end of the line. Empty lines, and lines
jerojasro@336 323 that contain only comments, are ignored.
jerojasro@336 324
jerojasro@336 325 You will often need to edit the \sfilename{series} file by hand, hence
jerojasro@336 326 the support for comments and empty lines noted above. For example,
jerojasro@336 327 you can comment out a patch temporarily, and \hgxcmd{mq}{qpush} will skip
jerojasro@336 328 over that patch when applying patches. You can also change the order
jerojasro@336 329 in which patches are applied by reordering their entries in the
jerojasro@336 330 \sfilename{series} file.
jerojasro@336 331
jerojasro@336 332 Placing the \sfilename{series} file under revision control is also
jerojasro@336 333 supported; it is a good idea to place all of the patches that it
jerojasro@336 334 refers to under revision control, as well. If you create a patch
jerojasro@336 335 directory using the \hgxopt{mq}{qinit}{-c} option to \hgxcmd{mq}{qinit}, this
jerojasro@336 336 will be done for you automatically.
jerojasro@336 337
jerojasro@336 338 \subsection{The \sfilename{status} file}
jerojasro@336 339
jerojasro@336 340 The \sfilename{status} file contains the names and changeset hashes of
jerojasro@336 341 all patches that MQ currently has applied. Unlike the
jerojasro@336 342 \sfilename{series} file, this file is not intended for editing. You
jerojasro@336 343 should not place this file under revision control, or modify it in any
jerojasro@336 344 way. It is used by MQ strictly for internal book-keeping.
jerojasro@336 345
jerojasro@336 346 %%% Local Variables:
jerojasro@336 347 %%% mode: latex
jerojasro@336 348 %%% TeX-master: "00book"
jerojasro@336 349 %%% End: