changeset 337:b8791971ba65

more mq.tex
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Mon, 31 Mar 2008 17:28:24 +0900
parents 57fb4684b8e3
children cb130184dd23
files ja/mq.tex
diffstat 1 files changed, 98 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/ja/mq.tex	Mon Mar 31 05:33:05 2008 +0900
+++ b/ja/mq.tex	Mon Mar 31 17:28:24 2008 +0900
@@ -753,60 +753,110 @@
 \section{$B$5$i$K%Q%C%A$K$D$$$F(B}
 \label{sec:mq:adv-patch}
 
-MQ uses the GNU \command{patch} command to apply patches, so it's
-helpful to know a few more detailed aspects of how \command{patch}
-works, and about patches themselves.
+%MQ uses the GNU \command{patch} command to apply patches, so it's
+%helpful to know a few more detailed aspects of how \command{patch}
+%works, and about patches themselves.
+
+MQ$B$O%Q%C%A$NE,MQ$K(BGNU$B$N(B\command{patch}$B%3%^%s%I$rMQ$$$k!%$=$N$?$a!$(B
+\command{patch}$B$NF0:n$H%Q%C%A<+BN$K$D$$$F$h$j>\$7$/CN$C$F$*$/$3$H$OM-MQ(B
+$B$G$"$k!%(B
 
 %\subsection{The strip count}
 \subsection{$B%9%H%j%C%W%+%&%s%H(B}
 
-If you look at the file headers in a patch, you will notice that the
-pathnames usually have an extra component on the front that isn't
-present in the actual path name.  This is a holdover from the way that
-people used to generate patches (people still do this, but it's
-somewhat rare with modern revision control tools).  
+%If you look at the file headers in a patch, you will notice that the
+%pathnames usually have an extra component on the front that isn't
+%present in the actual path name.  This is a holdover from the way that
+%people used to generate patches (people still do this, but it's
+%somewhat rare with modern revision control tools).  
+
+$B%Q%C%A$N%U%!%$%k%X%C%@$r8+$k$H!$%Q%9%M!<%`$N:G=i$KDI2C$NItJ,$,$D$$$F$$$k(B
+$B$N$K5$$E$/$O$:$@!%$3$l$O<B:]$N%Q%9%M!<%`$K$OB8:_$7$J$$$b$N$G!$%Q%C%A$r@8(B
+$B@.$9$k;~$N=,47$+$i$N0dJ*$G$"$k!%!JB?$/$N?M$,$$$^$@$3$NJ}K!$r;H$C$F$$$k$,!$(B
+$B6aBeE*$J%j%S%8%g%s%3%s%H%m!<%k%D!<%k$G$O$[$H$s$I8+$i$l$J$$!%!K(B
 
-Alice would unpack a tarball, edit her files, then decide that she
-wanted to create a patch.  So she'd rename her working directory,
-unpack the tarball again (hence the need for the rename), and use the
-\cmdopt{diff}{-r} and \cmdopt{diff}{-N} options to \command{diff} to
-recursively generate a patch between the unmodified directory and the
-modified one.  The result would be that the name of the unmodified
-directory would be at the front of the left-hand path in every file
-header, and the name of the modified directory would be at the front
-of the right-hand path.
+%Alice would unpack a tarball, edit her files, then decide that she
+%wanted to create a patch.  So she'd rename her working directory,
+%unpack the tarball again (hence the need for the rename), and use the
+%\cmdopt{diff}{-r} and \cmdopt{diff}{-N} options to \command{diff} to
+%recursively generate a patch between the unmodified directory and the
+%modified one.  
+%The result would be that the name of the unmodified
+%directory would be at the front of the left-hand path in every file
+%header, and the name of the modified directory would be at the front
+%of the right-hand path.
+
+$B%"%j%9$,(Btar$B%\!<%k$r2rE`$7!$%U%!%$%k$rJT=8$7!$%Q%C%A$r:n$j$?$$$H;W$C$F$$$k(B
+$B$H$9$k!%H`=w$O%o!<%-%s%0%G%#%l%/%H%j$r%j%M!<%`$7$F(Btar$B%\!<%k$r$b$&0lEY2rE`(B
+$B$7!J$3$N$?$a$K%j%M!<%`$,I,MW$@$C$?!K!$(B\command{diff}$B$K(B\cmdopt{diff}{-r}$B$H(B
+\cmdopt{diff}{-N}$B%*%W%7%g%s$r$D$1$F!$85$N$^$^$N%G%#%l%/%H%j$HJQ99$7$?%G%#(B
+$B%l%/%H%j$N4V$G:F5"E*$K%Q%C%A$r@8@.$9$k$@$m$&!%@8@.$5$l$?%Q%C%A$G$O!$A4$F(B
+$B$N%U%!%$%k%X%C%@$G85$N$^$^$N%G%#%l%/%H%j$NL>A0$,:8B&$N%Q%9$N@hF,$K!$JQ99(B
+$B$5$l$?%G%#%l%/%H%j$NL>A0$,1&B&$N%Q%9$N@hF,$K8=$l$k!%(B
 
-Since someone receiving a patch from the Alices of the net would be
-unlikely to have unmodified and modified directories with exactly the
-same names, the \command{patch} command has a \cmdopt{patch}{-p}
-option that indicates the number of leading path name components to
-strip when trying to apply a patch.  This number is called the
-\emph{strip count}.
+%Since someone receiving a patch from the Alices of the net would be
+%unlikely to have unmodified and modified directories with exactly the
+%same names, the \command{patch} command has a \cmdopt{patch}{-p}
+%option that indicates the number of leading path name components to
+%strip when trying to apply a patch.  This number is called the
+%\emph{strip count}.
+
+$B%M%C%H>e$N%"%j%9$?$A$+$i%Q%C%A$r<u$1<h$C$??M$O!$JQ99$J$7$N%G%#%l%/%H%j$H(B
+$BJQ99$5$l$?%G%#%l%/%H%j$NN>J}$r%"%j%9$HF1$8L>A0$G;}$C$F$$$k2DG=@-$O$^$:$J(B
+$B$$!%(B\command{patch}$B%3%^%s%I$K$O(B\cmdopt{patch}{-p}$B%*%W%7%g%s$,$"$j!$%Q%C(B
+$B%A$rE,MQ$9$k;~$K%Q%9$NMWAG$r@hF,$+$i$$$/$D:o$k$+$r;XDj$G$-$k!%$3$N?t$O(B
+\emph{$B%9%H%j%C%W%+%&%s%H(B}$B$H8F$P$l$k!%(B
 
-An option of ``\texttt{-p1}'' means ``use a strip count of one''.  If
-\command{patch} sees a file name \filename{foo/bar/baz} in a file
-header, it will strip \filename{foo} and try to patch a file named
-\filename{bar/baz}.  (Strictly speaking, the strip count refers to the
-number of \emph{path separators} (and the components that go with them
-) to strip.  A strip count of one will turn \filename{foo/bar} into
-\filename{bar}, but \filename{/foo/bar} (notice the extra leading
-slash) into \filename{foo/bar}.)
+%An option of ``\texttt{-p1}'' means ``use a strip count of one''.  If
+%\command{patch} sees a file name \filename{foo/bar/baz} in a file
+%header, it will strip \filename{foo} and try to patch a file named
+%\filename{bar/baz}.  (Strictly speaking, the strip count refers to the
+%number of \emph{path separators} (and the components that go with them
+%) to strip.  A strip count of one will turn \filename{foo/bar} into
+%\filename{bar}, but \filename{/foo/bar} (notice the extra leading
+%slash) into \filename{foo/bar}.)
 
-The ``standard'' strip count for patches is one; almost all patches
-contain one leading path name component that needs to be stripped.
-Mercurial's \hgcmd{diff} command generates path names in this form,
-and the \hgcmd{import} command and MQ expect patches to have a strip
-count of one.
+$B%*%W%7%g%s(B``\texttt{-p1}''$B$O(B``$B%9%H%j%C%W%+%&%s%H(B1$B$r;H$&(B''$B$H$$$&0UL#$G$"(B
+$B$k!%$b$7(B\command{patch}$B$,%U%!%$%k%X%C%@$K(B\filename{foo/bar/baz}$B$r8+$D$1(B
+$B$?;~$O!$(B\filename{foo}$B$rMn$7$F(B\filename{bar/baz}$B$H$$$&L>A0$N%U%!%$%k$K%Q%C(B
+$B%A$r;n$_$k!%!J87L)$K8@$&$H%9%H%j%C%W%+%&%s%H$O(B\emph{$B%Q%9%;%Q%l!<%?(B}$B$N?t(B
+$B$r;2>H$7$F$$$k!J7k2L$H$7$FMWAG$b;2>H$5$l$k!K%9%H%j%C%W%+%&%s%H(B1$B$O(B
+\filename{foo/bar}$B$r(B\filename{bar}$B$KJQ$($k!%$^$?(B\filename{/foo/bar}$B!JA0(B
+$B$KCV$+$l$?%9%i%C%7%e$KCm0U!K$O(B\filename{foo/bar}$B$H$J$k!%!K(B
+
+%The ``standard'' strip count for patches is one; almost all patches
+%contain one leading path name component that needs to be stripped.
+%Mercurial's \hgcmd{diff} command generates path names in this form,
+%and the \hgcmd{import} command and MQ expect patches to have a strip
+%count of one.
+
+$B%Q%C%A$X$N(B``$BI8=`E*$J(B''$B%9%H%j%C%W%+%&%s%H$O(B1$B$G$"$k!%$[$H$s$IA4$F$N%Q%C%A(B
+$B$O<h$j=|$/$Y$-%Q%9MWAG$r0l$D;}$C$F$$$k!%(BMercurial$B$N(B\hgcmd{diff}$B%3%^%s%I(B
+$B$O%Q%9L>$r$3$N7A<0$G@8@.$7!$(B\hgcmd{import}$B%3%^%s%I$H(BMQ$B$O%9%H%j%C%W%+%&%s(B
+$B%H(B1$B$rA0Ds$H$7$F$$$k!%(B
 
 If you receive a patch from someone that you want to add to your patch
 queue, and the patch needs a strip count other than one, you cannot
 just \hgxcmd{mq}{qimport} the patch, because \hgxcmd{mq}{qimport} does not yet
-have a \texttt{-p} option (see~\bug{311}).  Your best bet is to
+have a \texttt{-p} option (see~\bug{311}).  
+
+Your best bet is to
 \hgxcmd{mq}{qnew} a patch of your own, then use \cmdargs{patch}{-p\emph{N}}
 to apply their patch, followed by \hgcmd{addremove} to pick up any
 files added or removed by the patch, followed by \hgxcmd{mq}{qrefresh}.
 This complexity may become unnecessary; see~\bug{311} for details.
 
+$BC/$+$+$i%Q%C%A$r<u$1<h$j!$%Q%C%A%-%e!<$KDI2C$7$h$&$H$9$k;~!$%Q%C%A%+%&%s(B
+$B%H$,(B1$B0J30$G$"$l$PC1$K(B\hgxcmd{mq}{qimport}$B$9$k$3$H$O$G$-$J$$!%$3$l$O(B
+\hgxcmd{mq}{qimport}$B%3%^%s%I$,$^$@(B\texttt{-p}$B%*%W%7%g%s$r;}$C$F$$$J$$$?(B
+$B$a$@!J(B\bug{311}$B$r;2>H!K!%(B
+
+$B0lHVNI$5$=$&$J$N$O!$(B\hgxcmd{mq}{qnew}$B$G?7$?$K%Q%C%A$r:n$j!$(B
+\cmdargs{patch}{-p\emph{N}}$B$r<B9T$7$F<u$1<h$C$?%Q%C%A$rE,MQ$7$?8e!$(B
+$B%Q%C%A$K$h$C$FDI2C$5$l$?$j:o=|$5$l$?%U%!%$%k$r(B\hgcmd{addremove}$B$K$h$C$F(B
+$B%T%C%/%"%C%W$7!$(B\hgxcmd{mq}{qrefresh}$B$r<B9T$9$k$3$H$G$"$k!%$3$NJ#;($J<j(B
+$B=g$O>-MhE*$K$OI,MW$J$/$J$k$O$:$@!J(B\bug{311}$B$r;2>H!K!%(B
+
 %\subsection{Strategies for applying a patch}
 \subsection{$B%Q%C%AE,MQ$N$?$a$N@oN,(B}
 
@@ -816,6 +866,9 @@
 that was generated against an old version of a file, and apply it
 against a newer version of that file.
 
+\command{patch}$B$,(Bhunk$B$rE,MQ$9$k$H$-!$(B
+
+
 First, \command{patch} tries an exact match, where the line numbers,
 the context, and the text to be modified must apply exactly.  If it
 cannot make an exact match, it tries to find an exact match for the
@@ -1319,8 +1372,11 @@
 %\subsection{Merging part of one patch into another}
 \subsection{$B%Q%C%A$N0lItJ,$rJL$N%Q%C%A$X%^!<%8$9$k(B}
 
-Merging \emph{part} of one patch into another is more difficult than
-combining entire patches.
+%Merging \emph{part} of one patch into another is more difficult than
+%combining entire patches.
+
+$B%Q%C%A$N(B\emph{$B0lIt(B}$B$rJL$N%Q%C%A$X%^!<%8$9$k$3$H$O!$%Q%C%A$r7k9g$9$k$h$j(B
+$B$OFq$7$$!%(B
 
 If you want to move changes to entire files, you can use
 \command{filterdiff}'s \cmdopt{filterdiff}{-i} and
@@ -1332,6 +1388,9 @@
 other patch), and you can simply \hgxcmd{mq}{qrefresh} the patch to drop
 the duplicate hunks.
 
+
+
+
 If you have a patch that has multiple hunks modifying a file, and you
 only want to move a few of those hunks, the job becomes more messy,
 but you can still partly automate it.  Use \cmdargs{lsdiff}{-nvv} to