Mercurial > hgbook
comparison en/mq.tex @ 12:1f692024d438
More text for MQ chapter.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 29 Jun 2006 08:36:53 -0700 |
parents | e9d5b4c3d16b |
children | 5c3966f6991b |
comparison
equal
deleted
inserted
replaced
11:e9d5b4c3d16b | 12:1f692024d438 |
---|---|
131 Because MQ is implemented as an extension, you must explicitly enable | 131 Because MQ is implemented as an extension, you must explicitly enable |
132 before you can use it. (You don't need to download anything; MQ ships | 132 before you can use it. (You don't need to download anything; MQ ships |
133 with the standard Mercurial distribution.) To enable MQ, edit your | 133 with the standard Mercurial distribution.) To enable MQ, edit your |
134 \tildefile{.hgrc} file, and add the lines in figure~\ref{ex:mq:config}. | 134 \tildefile{.hgrc} file, and add the lines in figure~\ref{ex:mq:config}. |
135 | 135 |
136 \begin{figure}[h] | 136 \begin{figure}[ht] |
137 \begin{codesample4} | 137 \begin{codesample4} |
138 [extensions] | 138 [extensions] |
139 hgext.mq = | 139 hgext.mq = |
140 \end{codesample4} | 140 \end{codesample4} |
141 \label{ex:mq:config} | 141 \label{ex:mq:config} |
145 Once the extension is enabled, it will make a number of new commands | 145 Once the extension is enabled, it will make a number of new commands |
146 available. To verify that the extension is working, you can use | 146 available. To verify that the extension is working, you can use |
147 \hgcmd{help} to see if the \hgcmd{qinit} command is now available; see | 147 \hgcmd{help} to see if the \hgcmd{qinit} command is now available; see |
148 the example in figure~\ref{ex:mq:enabled}. | 148 the example in figure~\ref{ex:mq:enabled}. |
149 | 149 |
150 \begin{figure}[h] | 150 \begin{figure}[ht] |
151 \interaction{mq.qinit-help.help} | 151 \interaction{mq.qinit-help.help} |
152 \caption{How to verify that MQ is enabled} | 152 \caption{How to verify that MQ is enabled} |
153 \label{ex:mq:enabled} | 153 \label{ex:mq:enabled} |
154 \end{figure} | 154 \end{figure} |
155 | 155 |
159 figure~\ref{ex:mq:qinit}). This command creates an empty directory | 159 figure~\ref{ex:mq:qinit}). This command creates an empty directory |
160 called \filename{.hg/patches}, where MQ will keep its metadata. As | 160 called \filename{.hg/patches}, where MQ will keep its metadata. As |
161 with many Mercurial commands, the \hgcmd{qinit} command prints nothing | 161 with many Mercurial commands, the \hgcmd{qinit} command prints nothing |
162 if it succeeds. | 162 if it succeeds. |
163 | 163 |
164 \begin{figure}[h] | 164 \begin{figure}[ht] |
165 \interaction{mq.tutorial.qinit} | 165 \interaction{mq.tutorial.qinit} |
166 \caption{Preparing a repository for use with MQ} | 166 \caption{Preparing a repository for use with MQ} |
167 \label{ex:mq:qinit} | 167 \label{ex:mq:qinit} |
168 \end{figure} | 168 \end{figure} |
169 | 169 |
170 \begin{figure}[h] | 170 \begin{figure}[ht] |
171 \interaction{mq.tutorial.qnew} | 171 \interaction{mq.tutorial.qnew} |
172 \caption{Creating a new patch} | 172 \caption{Creating a new patch} |
173 \label{ex:mq:qnew} | 173 \label{ex:mq:qnew} |
174 \end{figure} | 174 \end{figure} |
175 | 175 |
205 \hgcmd{qrefresh} command (figure~\ref{ex:mq:qnew}) to update the patch | 205 \hgcmd{qrefresh} command (figure~\ref{ex:mq:qnew}) to update the patch |
206 you are working on. This command folds the changes you have made in | 206 you are working on. This command folds the changes you have made in |
207 the working directory into your patch, and updates its corresponding | 207 the working directory into your patch, and updates its corresponding |
208 changeset to contain those changes. | 208 changeset to contain those changes. |
209 | 209 |
210 \begin{figure}[h] | 210 \begin{figure}[ht] |
211 \interaction{mq.tutorial.qrefresh} | 211 \interaction{mq.tutorial.qrefresh} |
212 \caption{Refreshing a patch} | 212 \caption{Refreshing a patch} |
213 \label{ex:mq:qrefresh} | 213 \label{ex:mq:qrefresh} |
214 \end{figure} | 214 \end{figure} |
215 | 215 |
216 You can run \hgcmd{qrefresh} as often as you like, so it's a good way | 216 You can run \hgcmd{qrefresh} as often as you like, so it's a good way |
217 to ``checkpoint'' your work. Reefresh your patch at an opportune | 217 to ``checkpoint'' your work. Reefresh your patch at an opportune |
218 time; try an experiment; and if the experiment doesn't work out, | 218 time; try an experiment; and if the experiment doesn't work out, |
219 \hgcmd{revert} your modifications back to the last time you refreshed. | 219 \hgcmd{revert} your modifications back to the last time you refreshed. |
220 | 220 |
221 \begin{figure}[h] | 221 \begin{figure}[ht] |
222 \interaction{mq.tutorial.qrefresh2} | 222 \interaction{mq.tutorial.qrefresh2} |
223 \caption{Refresh a patch many times to accumulate changes} | 223 \caption{Refresh a patch many times to accumulate changes} |
224 \label{ex:mq:qrefresh2} | 224 \label{ex:mq:qrefresh2} |
225 \end{figure} | 225 \end{figure} |
226 | 226 |
231 Mercurial will apply this patch on top of your existing patch. See | 231 Mercurial will apply this patch on top of your existing patch. See |
232 figure~\ref{ex:mq:qnew2} for an example. Notice that the patch | 232 figure~\ref{ex:mq:qnew2} for an example. Notice that the patch |
233 contains the changes in our prior patch as part of its context (you | 233 contains the changes in our prior patch as part of its context (you |
234 can see this more clearly in the output of \hgcmd{annotate}). | 234 can see this more clearly in the output of \hgcmd{annotate}). |
235 | 235 |
236 \begin{figure}[h] | 236 \begin{figure}[ht] |
237 \interaction{mq.tutorial.qnew2} | 237 \interaction{mq.tutorial.qnew2} |
238 \caption{Stacking a second patch on top of the first} | 238 \caption{Stacking a second patch on top of the first} |
239 \label{ex:mq:qnew2} | 239 \label{ex:mq:qnew2} |
240 \end{figure} | 240 \end{figure} |
241 | 241 |
251 \item The \hgcmd{qapplied} command lists every patch that MQ has | 251 \item The \hgcmd{qapplied} command lists every patch that MQ has |
252 \emph{applied} in this repository, again from oldest to newest (most | 252 \emph{applied} in this repository, again from oldest to newest (most |
253 recently applied). | 253 recently applied). |
254 \end{itemize} | 254 \end{itemize} |
255 | 255 |
256 \begin{figure}[h] | 256 \begin{figure}[ht] |
257 \interaction{mq.tutorial.qseries} | 257 \interaction{mq.tutorial.qseries} |
258 \caption{Understanding the patch stack with \hgcmd{qseries} and | 258 \caption{Understanding the patch stack with \hgcmd{qseries} and |
259 \hgcmd{qapplied}} | 259 \hgcmd{qapplied}} |
260 \label{ex:mq:qseries} | 260 \label{ex:mq:qseries} |
261 \end{figure} | 261 \end{figure} |
267 manage a patch without it being applied in the repository. | 267 manage a patch without it being applied in the repository. |
268 | 268 |
269 An \emph{applied} patch has a corresponding changeset in the | 269 An \emph{applied} patch has a corresponding changeset in the |
270 repository, and the effects of the patch and changeset are visible in | 270 repository, and the effects of the patch and changeset are visible in |
271 the working directory. You can undo the application of a patch using | 271 the working directory. You can undo the application of a patch using |
272 the \hgcmd{qpop} command. MQ still \emph{knows about} a popped patch, | 272 the \hgcmd{qpop} command. MQ still \emph{knows about}, or manages, a |
273 but it no longer has a corresponding changeset in the repository, and | 273 popped patch, but the patch no longer has a corresponding changeset in |
274 the working directory does not contain the changes made by the patch. | 274 the repository, and the working directory does not contain the changes |
275 | 275 made by the patch. Figure~\ref{fig:mq:stack} illustrates the |
276 \begin{figure}[h] | 276 difference between applied and tracked patches. |
277 \interaction{mq.tutorial.qpop} | 277 |
278 \caption{Modifying the stack of applied patches} | 278 \begin{figure}[ht] |
279 \label{ex:mq:qpop} | 279 \centering |
280 \grafix{mq-stack} | |
281 \caption{Applied and unapplied patches in the MQ patch stack} | |
282 \label{fig:mq:stack} | |
280 \end{figure} | 283 \end{figure} |
281 | 284 |
282 You can reapply an unapplied, or popped, patch using the \hgcmd{qpush} | 285 You can reapply an unapplied, or popped, patch using the \hgcmd{qpush} |
283 command. This creates a new changeset to correspond to the patch, and | 286 command. This creates a new changeset to correspond to the patch, and |
284 the patch's changes once again become present in the working | 287 the patch's changes once again become present in the working |
285 directory. See figure~\ref{ex:mq:qpop} for examples of \hgcmd{qpop} | 288 directory. See figure~\ref{ex:mq:qpop} for examples of \hgcmd{qpop} |
286 and \hgcmd{qpush} in action. Notice that once we have popped a patch | 289 and \hgcmd{qpush} in action. Notice that once we have popped a patch |
287 or two patches, the output of \hgcmd{qseries} remains the same, while | 290 or two patches, the output of \hgcmd{qseries} remains the same, while |
288 that of \hgcmd{qapplied} has changed. | 291 that of \hgcmd{qapplied} has changed. |
289 | 292 |
290 \begin{figure} | 293 \begin{figure}[ht] |
291 \centering | 294 \interaction{mq.tutorial.qpop} |
292 \grafix{mq-stack} | 295 \caption{Modifying the stack of applied patches} |
293 \caption{Applied and unapplied patches in the MQ patch stack} | 296 \label{ex:mq:qpop} |
294 \label{fig:mq:stack} | |
295 \end{figure} | 297 \end{figure} |
296 | 298 |
297 MQ does not limit you to pushing or popping one patch. You can have | 299 MQ does not limit you to pushing or popping one patch. You can have |
298 no patches, all of them, or any number in between applied at some | 300 no patches, all of them, or any number in between applied at some |
299 point in time. | 301 point in time. |