Mercurial > hgbook
comparison ja/mq.tex @ 838:d1f676a6a4b3 default tip
update mq chapter.
propagate ef53d025f410.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 03 Dec 2009 01:26:08 +0900 |
parents | 8a3041e6f3cb |
children |
comparison
equal
deleted
inserted
replaced
837:b775f963b18c | 838:d1f676a6a4b3 |
---|---|
188 | 188 |
189 %In mid-2005, Chris Mason took the features of quilt and wrote an | 189 %In mid-2005, Chris Mason took the features of quilt and wrote an |
190 %extension that he called Mercurial Queues, which added quilt-like | 190 %extension that he called Mercurial Queues, which added quilt-like |
191 %behaviour to Mercurial. | 191 %behaviour to Mercurial. |
192 | 192 |
193 2005$BG/$NCf:"(BChris Mason$B$O!$(Bquilt$B$N5!G=$r<h$jF~$l$F!$(BMercurial$B$K(Bquilt$B$N$h(B | 193 2005$BG/$NCf:"!$(BChris Mason$B$O!$(Bquilt$B$N5!G=$r<h$jF~$l$F!$(BMercurial$B$K(Bquilt$B$N(B |
194 $B$&$JF0:n$rDI2C$9$k(BMercurial Queues$B$H$$$&%(%/%9%F%s%7%g%s$r=q$$$?!%(B | 194 $B$h$&$JF0:n$rDI2C$9$k(BMercurial Queues$B$H$$$&%(%/%9%F%s%7%g%s$r=q$$$?!%(B |
195 | 195 |
196 %The key difference between quilt and MQ is that quilt knows nothing | 196 %The key difference between quilt and MQ is that quilt knows nothing |
197 %about revision control systems, while MQ is \emph{integrated} into | 197 %about revision control systems, while MQ is \emph{integrated} into |
198 %Mercurial. Each patch that you push is represented as a Mercurial | 198 %Mercurial. Each patch that you push is represented as a Mercurial |
199 %changeset. Pop a patch, and the changeset goes away. | 199 %changeset. Pop a patch, and the changeset goes away. |
1029 | 1029 |
1030 $B;DG0$J$3$H$K!$%j%8%'%/%H$5$l$?(Bhunk$B$r<h$j07$&7h$^$C$?NI$$J}K!$OB8:_$7$J(B | 1030 $B;DG0$J$3$H$K!$%j%8%'%/%H$5$l$?(Bhunk$B$r<h$j07$&7h$^$C$?NI$$J}K!$OB8:_$7$J(B |
1031 $B$$!%BgDq$N>l9g!$(B\sfilename{.rej}$B%U%!%$%k$r8+$F%?!<%2%C%H%U%!%$%k$rJT=8(B | 1031 $B$$!%BgDq$N>l9g!$(B\sfilename{.rej}$B%U%!%$%k$r8+$F%?!<%2%C%H%U%!%$%k$rJT=8(B |
1032 $B$7!$%j%8%'%/%H$5$l$?(Bhunk$B$r<j$GE,MQ$9$k$3$H$K$J$k!%(B | 1032 $B$7!$%j%8%'%/%H$5$l$?(Bhunk$B$r<j$GE,MQ$9$k$3$H$K$J$k!%(B |
1033 | 1033 |
1034 %If you're feeling adventurous, Neil Brown, a Linux kernel hacker, | 1034 %A Linux kernel hacker, Chris Mason (the author of Mercurial Queues), |
1035 %wrote a tool called \command{wiggle}~\cite{web:wiggle}, which is more | 1035 %wrote a tool called \command{mpatch}~\cite{web:mpatch}, which takes a |
1036 %vigorous than \command{patch} in its attempts to make a patch apply. | 1036 %simple approach to automating the application of hunks rejected by |
1037 | 1037 %\command{patch}. The \command{mpatch} command can help with four common |
1038 $BKA81$,9%$-$J$i!$(BLinux kerner$B%O%C%+!<$N(BNeil Brown$B$,=q$$$?(B | 1038 %reasons that a hunk may be rejected: |
1039 \command{wiggle}~\cite{web:wiggle}$B$r;n$7$F$_$k$HNI$$!%$3$N%3%^%s%I$O(B | 1039 |
1040 \command{patch}$B$h$j$b@:NOE*$K%Q%C%A$NE,MQ$r;n$_$k!%(B | 1040 Linux kerner$B%O%C%+!<(B Chris Mason$B!J(BMercurial Queues$B$N:n<T$G$b$"$k!%!K(B |
1041 | |
1042 %Another Linux kernel hacker, Chris Mason (the author of Mercurial | |
1043 %Queues), wrote a similar tool called | |
1044 %\command{mpatch}~\cite{web:mpatch}, which takes a simple approach to | |
1045 %automating the application of hunks rejected by \command{patch}. The | |
1046 %\command{mpatch} command can help with four common reasons that a hunk | |
1047 %may be rejected: | |
1048 | |
1049 $BJL$N(BLinux kerner$B%O%C%+!<(B Chris Mason$B!J(BMercurial Queues$B$N:n<T$G$b$"$k!%!K(B | |
1050 $B$O(B\command{mpatch}~\cite{web:mpatch}$B$H$$$&%D!<%k$r=q$$$?!%$3$N%3%^%s%I$O(B | 1041 $B$O(B\command{mpatch}~\cite{web:mpatch}$B$H$$$&%D!<%k$r=q$$$?!%$3$N%3%^%s%I$O(B |
1051 \command{patch}$B%3%^%s%I$G%j%8%'%/%H$5$l$?(Bhunk$B$NE,MQ$r<+F02=$9(B | 1042 \command{patch}$B%3%^%s%I$G%j%8%'%/%H$5$l$?(Bhunk$B$NE,MQ$r<+F02=$9(B |
1052 $B$k!%(B\command{mpatch}$B%3%^%s%I$O!$(Bhunk$B$,%j%8%'%/%H$5$l$k<g$J860x(B4$B$D$KBP1~(B | 1043 $B$k!%(B\command{mpatch}$B%3%^%s%I$O!$(Bhunk$B$,%j%8%'%/%H$5$l$k<g$J860x(B4$B$D$KBP1~(B |
1053 $B$9$k(B: | 1044 $B$9$k(B: |
1054 | 1045 |
1065 % currently present in the file. | 1056 % currently present in the file. |
1066 \item hunk$BFb$N9T$,8=:_%U%!%$%k$K$"$k9T$H<c430c$C$F$$$k>l9g!$$=$N9T$r:o=|(B | 1057 \item hunk$BFb$N9T$,8=:_%U%!%$%k$K$"$k9T$H<c430c$C$F$$$k>l9g!$$=$N9T$r:o=|(B |
1067 $B$9$k(B | 1058 $B$9$k(B |
1068 \end{itemize} | 1059 \end{itemize} |
1069 | 1060 |
1070 %If you use \command{wiggle} or \command{mpatch}, you should be doubly | 1061 %If you use \command{mpatch}, you should be doubly careful to |
1071 %careful to check your results when you're done. In fact, | 1062 %check your results when you're done. In fact, \command{mpatch} |
1072 %\command{mpatch} enforces this method of double-checking the tool's | 1063 %enforces this method of double-checking the tool's |
1073 %output, by automatically dropping you into a merge program when it has | 1064 %output, by automatically dropping you into a merge program when it has |
1074 %done its job, so that you can verify its work and finish off any | 1065 %done its job, so that you can verify its work and finish off any |
1075 %remaining merges. | 1066 %remaining merges. |
1076 | 1067 |
1077 \command{wiggle}$B$^$?$O(B\command{mpatch}$B$r;HMQ$7$?>l9g$O!$7k2L$K:Y?4$NCm0U(B | 1068 \command{mpatch}$B$r;HMQ$7$?>l9g$O!$7k2L$K:Y?4$NCm0U$,I,MW$G$"$k!%<B:]$K$O(B |
1078 $B$,I,MW$G$"$k!%<B:]$K$O(B\command{mpatch}$B$O%D!<%k$N=PNO$GFs=E%A%'%C%/$r6/@)(B | 1069 \command{mpatch}$B$O%D!<%k$N=PNO$GFs=E%A%'%C%/$r6/@)$7!$F0:n$,=*$k$H<+F0E*(B |
1079 $B$7!$F0:n$,=*$k$H<+F0E*$K%^!<%8%W%m%0%i%`$r5/F0$9$k!%$3$l$K$h$C$F:n6H$r3N(B | 1070 $B$K%^!<%8%W%m%0%i%`$r5/F0$9$k!%$3$l$K$h$C$F:n6H$r3NG'$7!$I,MW$J%^!<%8$r40(B |
1080 $BG'$7!$%^!<%8$r40N;$9$k$3$H$,$G$-$k!%(B | 1071 $BN;$9$k$3$H$,$G$-$k!%(B |
1072 | |
1073 | |
1074 %\section{More on patch management} | |
1075 \section{$B$5$i$J$k%Q%C%A4IM}(B} | |
1076 | |
1077 %As you grow familiar with MQ, you will find yourself wanting | |
1078 %to perform other kinds of patch management operations. | |
1079 | |
1080 MQ$B$K47$l$k$K=>$C$F!$JL$NJ}K!$G$b%Q%C%A4IM}$r$7$?$/$J$k$@$m$&!%(B | |
1081 | |
1082 %\subsection{Deleting unwanted patches} | |
1083 \subsection{$BITMW$J%Q%C%A$r>C5n$9$k(B} | |
1084 | |
1085 %If you want to get rid of a patch, use the \command{qdelete} command to | |
1086 %delete the patch file and remove its entry from the patch series. If | |
1087 %you try to delete a patch that is still applied, \command{qdelete} will | |
1088 %refuse. | |
1089 | |
1090 $B%Q%C%A$r>C5n$9$k$K$O!$(B\command{qdelete}$B%3%^%s%I$rMQ$$$F!$%Q%C%A%U%!%$%k$N(B | |
1091 $B>C5n$H%Q%C%A%(%s%H%j$N%Q%C%A%7%j!<%:$+$i$NKu>C$r9T$&!%(B\command{qdelete}$B$O(B | |
1092 $BE,MQCf$N%Q%C%A$O>C5n$7$J$$!%(B | |
1093 | |
1094 % &interaction.ch11-qdelete.go; | |
1095 \interaction{ch11-qdelete.go} | |
1096 | |
1097 %\subsection{Converting to and from permanent revisions} | |
1098 \subsection{$B1JB3E*$J%j%S%8%g%s$H$NAj8_JQ49(B} | |
1099 | |
1100 %Once you're done working on a patch and want to turn it into a permanent | |
1101 %changeset, use the \hgxopt{mq}{qdelete}{-r} command. Pass a revision to | |
1102 %the \option{-r} option to identify the patch that you want to turn into | |
1103 %a regular changeset; this patch must already be applied. | |
1104 | |
1105 $B%Q%C%A$G$N:n6H$,=*$j!$$3$l$r1JB3E*$J%A%'%s%8%;%C%H$XJQ49$7$?$$>l9g$O!$(B | |
1106 \hgxopt{mq}{qdelete}{-r}$B%3%^%s%I$rMQ$$$k!%(B\option{-r}$B%*%W%7%g%s$K%j%S%8%g(B | |
1107 $B%s$rEO$7!$$I$N%Q%C%A$rDL>o$N%A%'%s%8%;%C%H$KJQ49$7$?$$$N$+;XDj$9$k!%JQ49(B | |
1108 $BBP>]$N%Q%C%A$O$9$G$KE,MQ$5$l$F$$$J$1$l$P$J$i$J$$!%(B | |
1109 | |
1110 %&interaction.ch11-qdelete.convert; | |
1111 \interaction{ch11-qdelete.convert} | |
1112 | |
1113 %It is also possible to turn an existing changeset into a patch, by | |
1114 %passing the \option{-r} option to \command{qimport}. | |
1115 | |
1116 \command{qimport}$B%3%^%s%I$K(B\option{-r}$B%*%W%7%g%s$rEO$7$F!$$9$G$KB8:_$9$k(B | |
1117 $B%A%'%s%8%;%C%H$r%Q%C%A$KJQ49$9$k$3$H$b$G$-$k!%(B | |
1118 | |
1119 %&interaction.ch11-qdelete.import; | |
1120 \interaction{ch11-qdelete.import} | |
1121 | |
1122 %Note that it only makes sense to convert a changeset into a patch if you | |
1123 %have not propagated that changeset into any other repositories. The | |
1124 %imported changeset's ID will change every time you refresh the patch, | |
1125 %which will make Mercurial treat it as unrelated to the original | |
1126 %changeset if you have pushed it somewhere else. | |
1127 | |
1128 $B%A%'%s%8%;%C%H$+$i%Q%C%A$X$NJQ49$,0UL#$r;}$D$N$O!$%A%'%s%8%;%C%H$r$^$@B>(B | |
1129 $B$N%j%]%8%H%j$KGH5Z$5$;$F$$$J$$>l9g$K8B$i$l$k!%(BMercurial$B$O%Q%C%A$KJQ49$7$?(B | |
1130 $B%A%'%s%8%;%C%H$r85$N%A%'%s%8%;%C%H$H$OL54X78$J$b$N$H$7$F07$&$?$a!$%Q%C%A(B | |
1131 $B$r%j%U%l%C%7%e$9$kEY$K%A%'%s%8%;%C%H(BID$B$OJQ$o$k!%$9$G$KJL$N%j%]%8%H%j$K%A%'(B | |
1132 $B%s%8%;%C%H$r%W%C%7%e$7$F$$$k$J$i$P!$$3$l$i$N(BID$B$OAj0c$7$F$7$^$&!%(B | |
1133 | |
1081 | 1134 |
1082 %\section{Getting the best performance out of MQ} | 1135 %\section{Getting the best performance out of MQ} |
1083 \section{MQ$B$r:GBg8B$K3hMQ$9$k(B} | 1136 \section{MQ$B$r:GBg8B$K3hMQ$9$k(B} |
1084 \label{sec:mq:perf} | 1137 \label{sec:mq:perf} |
1085 | 1138 |
1086 %MQ is very efficient at handling a large number of patches. I ran | 1139 %MQ is very efficient at handling a large number of patches. I ran |
1087 %some performance experiments in mid-2006 for a talk that I gave at the | 1140 %some performance experiments in mid-2006 for a talk that I gave at the |
1088 %2006 EuroPython conference~\cite{web:europython}. I used as my data | 1141 %2006 EuroPython conference. I used as my data |
1089 %set the Linux 2.6.17-mm1 patch series, which consists of 1,738 | 1142 %set the Linux 2.6.17-mm1 patch series, which consists of 1,738 |
1090 %patches. I applied these on top of a Linux kernel repository | 1143 %patches. I applied these on top of a Linux kernel repository |
1091 %containing all 27,472 revisions between Linux 2.6.12-rc2 and Linux | 1144 %containing all 27,472 revisions between Linux 2.6.12-rc2 and Linux |
1092 %2.6.17. | 1145 %2.6.17. |
1093 | 1146 |