Mercurial > hgbook
comparison en/mq.tex @ 55:3f0176046fdc
Document qfold.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 02 Aug 2006 19:43:53 -0700 |
parents | 0c998750744f |
children | 81a2f7a639ed |
comparison
equal
deleted
inserted
replaced
54:e94202d88199 | 55:3f0176046fdc |
---|---|
604 \item A hunk removes lines with slightly different content than those | 604 \item A hunk removes lines with slightly different content than those |
605 currently present in the file. | 605 currently present in the file. |
606 \end{itemize} | 606 \end{itemize} |
607 | 607 |
608 If you use \command{wiggle} or \command{rej}, you should be doubly | 608 If you use \command{wiggle} or \command{rej}, you should be doubly |
609 careful to check your results when you're done. | 609 careful to check your results when you're done. In fact, |
610 \command{rej} enforces this method of double-checking the tool's | |
611 output, by automatically dropping you into a merge program when it has | |
612 done its job, so that you can verify its work and finish off any | |
613 remaining merges. | |
610 | 614 |
611 \section{Getting the best performance out of MQ} | 615 \section{Getting the best performance out of MQ} |
612 \label{sec:mq:perf} | 616 \label{sec:mq:perf} |
613 | 617 |
614 MQ is very efficient at handling a large number of patches. I ran | 618 MQ is very efficient at handling a large number of patches. I ran |
720 \section{Identifying patches} | 724 \section{Identifying patches} |
721 | 725 |
722 MQ commands that work with patches let you refer to a patch either by | 726 MQ commands that work with patches let you refer to a patch either by |
723 using its name or by a number. By name is obvious enough; pass the | 727 using its name or by a number. By name is obvious enough; pass the |
724 name \filename{foo.patch} to \hgcmd{qpush}, for example, and it will | 728 name \filename{foo.patch} to \hgcmd{qpush}, for example, and it will |
725 push patches until \filename{foo.patch} is applied. | 729 push patches until \filename{foo.patch} is applied. |
730 | |
731 As a shortcut, you can refer to a patch using both a name and a | |
732 numeric offset; \texttt{foo.patch-2} means ``two patches before | |
733 \texttt{foo.patch}'', while \texttt{bar.patch+4} means ``four patches | |
734 after \texttt{bar.patch}''. | |
726 | 735 |
727 Referring to a patch by index isn't much different. The first patch | 736 Referring to a patch by index isn't much different. The first patch |
728 printed in the output of \hgcmd{qseries} is patch zero (yes, it's one | 737 printed in the output of \hgcmd{qseries} is patch zero (yes, it's one |
729 of those start-at-zero counting systems); the second is patch one; and | 738 of those start-at-zero counting systems); the second is patch one; and |
730 so on | 739 so on |
944 \interaction{mq.tarball.repush} | 953 \interaction{mq.tarball.repush} |
945 | 954 |
946 \subsection{Combining entire patches} | 955 \subsection{Combining entire patches} |
947 \label{sec:mq:combine} | 956 \label{sec:mq:combine} |
948 | 957 |
949 It's easy to combine entire patches. | 958 MQ provides a command, \hgcmd{qfold} that lets you combine entire |
950 | 959 patches. This ``folds'' the patches you name, in the order you name |
951 \begin{enumerate} | 960 them, into the topmost applied patch, and concatenates their |
952 \item \hgcmd{qpop} your applied patches until neither patch is | 961 descriptions onto the end of its description. The patches that you |
953 applied. | 962 fold must be unapplied before you fold them. |
954 \item Concatenate the patches that you want to combine together: | 963 |
955 \begin{codesample4} | 964 The order in which you fold patches matters. If your topmost applied |
956 cat patch-to-drop.patch >> patch-to-augment.patch | 965 patch is \texttt{foo}, and you \hgcmd{qfold} \texttt{bar} and |
957 \end{codesample4} | 966 \texttt{quux} into it, you will end up with a patch that has the same |
958 The description from the first patch (if you have one) will be used | 967 effect as if you applied first \texttt{foo}, then \texttt{bar}, |
959 as the commit comment when you \hgcmd{qpush} the combined patch. | 968 followed by \texttt{quux}. |
960 Edit the patch description if you need to. | |
961 \item Use the \hgcmd{qdel} command to delete the patch you're dropping | |
962 from the \sfilename{series} file. | |
963 \item \hgcmd{qpush} the combined patch. Fix up any rejects. | |
964 \item \hgcmd{qrefresh} the combined patch to tidy it up. | |
965 \end{enumerate} | |
966 | 969 |
967 \subsection{Merging part of one patch into another} | 970 \subsection{Merging part of one patch into another} |
968 | 971 |
969 Merging \emph{part} of one patch into another is more difficult than | 972 Merging \emph{part} of one patch into another is more difficult than |
970 combining entire patches. | 973 combining entire patches. |
1054 | 1057 |
1055 \subsection{\hgcmd{qdiff}---print a diff of the topmost applied patch} | 1058 \subsection{\hgcmd{qdiff}---print a diff of the topmost applied patch} |
1056 | 1059 |
1057 The \hgcmd{qdiff} command prints a diff of the topmost applied patch. | 1060 The \hgcmd{qdiff} command prints a diff of the topmost applied patch. |
1058 It is equivalent to \hgcmdargs{diff}{-r-2:-1}. | 1061 It is equivalent to \hgcmdargs{diff}{-r-2:-1}. |
1062 | |
1063 \subsection{\hgcmd{qfold}---merge (``fold'') several patches into one} | |
1064 | |
1065 The \hgcmd{qfold} command merges multiple patches into the topmost | |
1066 applied patch, so that the topmost applied patch makes the union of | |
1067 all of the changes in the patches in question. | |
1068 | |
1069 The patches to fold must not be applied; \hgcmd{qfold} will exit with | |
1070 an error if any is. The order in which patches are folded is | |
1071 significant; \hgcmdargs{qfold}{a b} means ``apply the current topmost | |
1072 patch, followed by \texttt{a}, followed by \texttt{b}''. | |
1073 | |
1074 The comments from the folded patches are appended to the comments of | |
1075 the destination patch, with each block of comments separated by three | |
1076 asterisk (``\texttt{*}'') characters. Use the \hgopt{qfold}{-e} | |
1077 option to edit the commit message for the combined patch/changeset | |
1078 after the folding has completed. | |
1079 | |
1080 Options: | |
1081 \begin{itemize} | |
1082 \item[\hgopt{qfold}{-e}] Edit the commit message and patch description | |
1083 for the newly folded patch. | |
1084 \item[\hgopt{qfold}{-l}] Use the contents of the given file as the new | |
1085 commit message and patch description for the folded patch. | |
1086 \item[\hgopt{qfold}{-m}] Use the given text as the new commit message | |
1087 and patch description for the folded patch. | |
1088 \end{itemize} | |
1059 | 1089 |
1060 \subsection{\hgcmd{qheader}---display the header/description of a patch} | 1090 \subsection{\hgcmd{qheader}---display the header/description of a patch} |
1061 | 1091 |
1062 The \hgcmd{qheader} command prints the header, or description, of a | 1092 The \hgcmd{qheader} command prints the header, or description, of a |
1063 patch. By default, it prints the header of the topmost applied patch. | 1093 patch. By default, it prints the header of the topmost applied patch. |