Mercurial > hgbook
view ja/cmdref.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 |
line wrap: on
line source
%\chapter{Command reference} \chapter{$B%3%^%s%I%j%U%!%l%s%9(B} \label{cmdref} \cmdref{add}{$B<!2s$N%3%_%C%H$G%U%!%$%k$rDI2C(B} \optref{add}{I}{include} \optref{add}{X}{exclude} \optref{add}{n}{dry-run} \cmdref{diff}{$B%R%9%H%j$^$?$O%o!<%-%s%0%G%#%l%/%H%jFb$NJQ99$rI=<((B} %Show differences between revisions for the specified files or %directories, using the unified diff format. For a description of the %unified diff format, see section~\ref{sec:mq:patch}. $B;XDj$7$?%U%!%$%k!"%G%#%l%/%H%j$K$D$$$F%j%S%8%g%s4V$G$N:9J,$rI=<($9$k!#(B $BI=<($K$O(Bunified diff$B%U%)!<%^%C%H$,MQ$$$i$l$k!#(Bunified diff$B%U%)!<%^%C%H(B $B$K$D$$$F$N@bL@$O(B\ref{sec:mq:patch}$B$r;2>H$N$3$H!#(B %By default, this command does not print diffs for files that Mercurial %considers to contain binary data. To control this behaviour, see the %\hgopt{diff}{-a} and \hgopt{diff}{--git} options. $B%G%U%)%k%H$G$O%P%$%J%j%G!<%?$H9M$($i$l$k%U%!%$%k$N:9J,$O=PNO$7$J$$!%$3$N(B $B5sF0$O(B\hgopt{diff}{-a} $B$H(B \hgopt{diff}{--git}$B$K$h$C$FJQ99$G$-$k!%(B \subsection{$B%*%W%7%g%s(B} \loptref{diff}{nodates} %Omit date and time information when printing diff headers. diff$B%X%C%@$+$iF|IU$H;~4V>pJs$r>JN,$9$k!%(B \optref{diff}{B}{$B6u9T$rL5;k$9$k(B} %Do not print changes that only insert or delete blank lines. A line %that contains only whitespace is not considered blank. $B6u9T$NA^F~$^$?$O:o=|$@$1$NJQ99$rI=<($7$J$$!%6uGrJ8;z$,4^$^$l$k9T$O6u9T$H(B $B$O8+$J$5$l$J$$!%(B \optref{diff}{I}{include} %Include files and directories whose names match the given patterns. $B;XDj$7$?%Q%?!<%s$H%^%C%A$9$k%U%!%$%k$^$?$O%G%#%l%/%H%j$rBP>]$K2C$($k(B \optref{diff}{X}{exclude} %Exclude files and directories whose names match the given patterns. $B;XDj$7$?%Q%?!<%s$H%^%C%A$9$k%U%!%$%k$^$?$O%G%#%l%/%H%j$rBP>]$+$i=|30$9$k(B \optref{diff}{a}{text} %If this option is not specified, \hgcmd{diff} will refuse to print %diffs for files that it detects as binary. Specifying \hgopt{diff}{-a} %forces \hgcmd{diff} to treat all files as text, and generate diffs for %all of them. $B$3$N%*%W%7%g%s$,;XDj$5$l$J$1$l$P(B\hgcmd{diff}$B$O%P%$%J%j$HH=Dj$5$l$?%U%!%$(B $B%k$KBP$9$k(Bdiff$B$N@8@.$r9T$o$J$$!%(B\hgopt{diff}{-a}$B$r;XDj$9$k$H(B \hgcmd{diff}$B$OA4$F$N%U%!%$%k$r%F%-%9%H$H$7$F07$$!$A4$F$N%U%!%$%k$KBP$7$F(B diff$B$r@8@.$9$k!%(B %This option is useful for files that are ``mostly text'' but have a %few embedded NUL characters. If you use it on files that contain a %lot of binary data, its output will be incomprehensible. $B$3$N%*%W%7%g%s$O!$$[$\A4$F$,%F%-%9%H$@$,0lIt$K%L%kJ8;z$r4^$s$G$$$k$h$&$J(B $B%U%!%$%k$KBP$7$FM-MQ$G$"$k!%$3$N%*%W%7%g%s$r%P%$%J%j%G!<%?$,B?$/4^$^$l$k(B $B%U%!%$%k$KE,MQ$9$k$HL50UL#$J=PNO$K$J$k$@$m$&!%(B \optref{diff}{b}{ignore-space-change} %Do not print a line if the only change to that line is in the amount %of white space it contains. $B6uGr$NJQ99$N$_$N9T$K$D$$$F=PNO$7$J$$!%(B \optref{diff}{g}{git} %Print \command{git}-compatible diffs. XXX reference a format %description. \command{git}$B8_49$N(Bdiff$B$r=PNO$9$k!%(B \optref{diff}{p}{show-function} %Display the name of the enclosing function in a hunk header, using a %simple heuristic. This functionality is enabled by default, so the %\hgopt{diff}{-p} option has no effect unless you change the value of %the \rcitem{diff}{showfunc} config item, as in the following example. %\interaction{cmdref.diff-p} $B%O%s%/%X%C%@$NCf$K4^$^$l$F$$$k4X?t$NL>A0$rI=<($9$k!%8!:w$OC1=c$JH/8+E*J}(B $BK!$G9T$&!%$3$N5!G=$O%G%U%)%k%H$GM-8z$K$5$l$F$*$j!$(B\hgopt{diff}{-p}$B%*%W(B $B%7%g%s$O2<$NNc$N$h$&$K(B\rcitem{diff}{showfunc}$B@_Dj$rJQ99$5$l$k$^$G0UL#$r$J(B $B$5$J$$!%(B \interaction{cmdref.diff-p} \optref{diff}{r}{rev} %Specify one or more revisions to compare. The \hgcmd{diff} command %accepts up to two \hgopt{diff}{-r} options to specify the revisions to %compare. $BHf3S$9$kBP>]$N%j%S%8%g%s$r0l$D0J>e;XDj$9$k!%(B\hgcmd{diff}$B%3%^%s%I$O!$(B $BHf3S$9$k%j%S%8%g%s$r;XDj$9$k$?$a$K(B\hgopt{diff}{-r}$B%*%W%7%g%s$r(B2$B$D$^(B $B$G<u$1IU$1$k!%(B %\begin{enumerate} %\setcounter{enumi}{0} %\item Display the differences between the parent revision of the % working directory and the working directory. %\item Display the differences between the specified changeset and the % working directory. %\item Display the differences between the two specified changesets. %\end{enumerate} \begin{enumerate} \setcounter{enumi}{0} \item $B?F%j%S%8%g%s$N%o!<%-%s%0%G%#%l%/%H%j$H!$8=:_$N%o!<%-%s%0%G%#%l%/%H(B $B%j$N:9J,$rI=<(!%(B \item $B;XDj$5$l$?%A%'%s%8%;%C%H$H8=:_$N%o!<%-%s%0%G%#%l%/%H%j$N:9J,$rI=<(!%(B \item $B;XDj$5$l$?(B2$B$D$N%A%'%s%8%;%C%H4V$N:9J,$rI=<(!%(B \end{enumerate} %You can specify two revisions using either two \hgopt{diff}{-r} %options or revision range notation. For example, the two revision %specifications below are equivalent. 2$B$D$N%j%S%8%g%s$r;XDj$9$kJ}K!$H$7$F!$(B\hgopt{diff}{-r}$B$r(B2$B$D;H$C$F$b$$$$$7!$(B $B%j%S%8%g%s%l%s%85-K!$r;H$C$F$bNI$$!%Nc$($P!$2<$N(B2$B$D$N%j%S%8%g%s;XDj$OEy(B $B2A$G$"$k!%(B \begin{codesample2} hg diff -r 10 -r 20 hg diff -r10:20 \end{codesample2} %When you provide two revisions, Mercurial treats the order of those %revisions as significant. Thus, \hgcmdargs{diff}{-r10:20} will %produce a diff that will transform files from their contents as of %revision~10 to their contents as of revision~20, while %\hgcmdargs{diff}{-r20:10} means the opposite: the diff that will %transform files from their revision~20 contents to their revision~10 %contents. You cannot reverse the ordering in this way if you are %diffing against the working directory. 2$B$D$N%j%S%8%g%s$r;XDj$9$k;~!$%j%S%8%g%s;XDj$N=g=x$K$O0UL#$,$"$k!%(B \hgcmdargs{diff}{-r10:20}$B$O%U%!%$%k$NFbMF$,%j%S%8%g%s(B10$B$+$i%j%S%8%g%s(B20 $B$KJQ$o$C$?$H$7$F:9J,$r:n@.$9$k!%(B\hgcmdargs{diff}{-r20:10}$B$G$"$l$P5U$N0U(B $BL#$K$J$k!%%o!<%-%s%0%G%#%l%/%H%j$N:9J,$r<h$k>l9g$K$O$3$N$h$&$K%j%S%8%g%s(B $B$N=g=x$r5U$K$9$k$3$H$O$G$-$J$$!%(B \optref{diff}{w}{ignore-all-space} \cmdref{version}{$B%P!<%8%g%s>pJs$H%3%T!<%i%$%H>pJs$rI=<($9$k(B} %This command displays the version of Mercurial you are running, and %its copyright license. There are four kinds of version string that %you may see. $B$3$N%3%^%s%I$O8=:_F0:nCf$N(BMercurial$B$N%P!<%8%g%s$H%3%T!<%i%$%H%i%$%;%s%9(B $B$rI=<($9$k!%%a%C%;!<%8$O(B4$B<oN`$"$k!%(B %\begin{itemize} %\item The string ``\texttt{unknown}''. This version of Mercurial was % not built in a Mercurial repository, and cannot determine its own % version. %\item A short numeric string, such as ``\texttt{1.1}''. This is a % build of a revision of Mercurial that was identified by a specific % tag in the repository where it was built. (This doesn't necessarily % mean that you're running an official release; someone else could % have added that tag to any revision in the repository where they % built Mercurial.) %\item A hexadecimal string, such as ``\texttt{875489e31abe}''. This % is a build of the given revision of Mercurial. %\item A hexadecimal string followed by a date, such as % ``\texttt{875489e31abe+20070205}''. This is a build of the given % revision of Mercurial, where the build repository contained some % local changes that had not been committed. %\end{itemize} \begin{itemize} \item $BJ8;zNs(B``\texttt{unknown}''$B!%(B $B$3$N%P!<%8%g%s$N(BMercurial$B$O(BMercurial$B%j(B $B%]%8%H%j$NCf$G%S%k%I$5$l$?$N$G$O$J$$$?$a!$<+J,<+?H$N%j%S%8%g%s$OJ,(B $B$+$i$J$$(B \item ``\texttt{1.1}''$B$N$h$&$JC;$$?tCMJ8;zNs!%$3$l$O%S%k%I%j%]%8%H%jFb$G(B $B%?%0IU$1$5$l$?FCDj$N%j%S%8%g%s$N(BMercurial$B$G$"$k$3$H$r<($9!%!J$3$l$O(B $B@5<0%j%j!<%9HG$G$"$k$H$$$&$3$H$rI,$:$7$b0UL#$7$J$$!%(BMercurial$B$r%S%k(B $B%I$9$k%j%]%8%H%j$G%?%0$rIU$1$k$N$OC/$G$b$I$N%j%S%8%g%s$KBP$7$F$b2D(B $BG=$G$"$k!K(B \item ``\texttt{875489e31abe}''$B$N$h$&$J(B16$B?J?tJ8;zNs!%$3$l$O(BMercurial$B$,I=(B $B<($5$l$?%j%S%8%g%s$N%S%k%I$G$"$k$3$H$r<($9!%(B \item ``\texttt{875489e31abe+20070205}''$B$N$h$&$J(B16$B?JJ8;zNs!\F|IU!%$3$l$O(B $B$=$N%j%S%8%g%s$KBP$7$F%3%_%C%H$5$l$F$$$J$$%m!<%+%k$JJQ99$r2C$($?%=!<(B $B%9$+$i%S%k%I$5$l$?(BMercurial$B$G$"$k$3$H$r<($9!%(B \end{itemize} %\subsection{Tips and tricks} \subsection{Tips and tricks} \subsubsection{Why do the results of \hgcmd{diff} and \hgcmd{status} differ?} \label{cmdref:diff-vs-status} %When you run the \hgcmd{status} command, you'll see a list of files %that Mercurial will record changes for the next time you perform a %commit. If you run the \hgcmd{diff} command, you may notice that it %prints diffs for only a \emph{subset} of the files that \hgcmd{status} %listed. There are two possible reasons for this. \hgcmd{status}$B$r<B9T$7$?;~!$(BMercurial$B$O<!2s$N%3%_%C%H$G5-O?$9$kJQ99$N%j(B $B%9%H$rI=<($9$k!%(B\hgcmd{diff}$B$r<B9T$9$k$H!$(B\hgcmd{status}$B$N(B\emph{$B0lIt(B $B$N(B}diff$B$,I=<($5$l$k$3$H$K5$IU$/$@$m$&!%$3$l$K$OFs$D$NM}M3$,9M$($i$l$k!%(B %The first is that \hgcmd{status} prints some kinds of modifications %that \hgcmd{diff} doesn't normally display. The \hgcmd{diff} command %normally outputs unified diffs, which don't have the ability to %represent some changes that Mercurial can track. Most notably, %traditional diffs can't represent a change in whether or not a file is %executable, but Mercurial records this information. 1$B$DL\$O(B\hgcmd{status}$B$,(B\hgcmd{diff}$B$,DL>oI=<($7$J$$2?<oN`$+$NJQ99$rI=<($9(B $B$k$?$a$G$"$k!%(B\hgcmd{diff}$B$ODL>o(Bunified diff$B7A<0$G=PNO$9$k$,!$$3$l$O(B Mercurial$B$,DI@W$G$-$kJQ99$N$$$/$D$+$rDI@W$G$-$J$$!%FC$K!$8E$$(Bdiff$B$G$O%U%!(B $B%$%k$,<B9T$+$N$&$+$I$&$+$rI=8=$G$-$J$$$,!$(BMercurial$B$O$3$N>pJs$r5-O?$9$k!%(B %If you use the \hgopt{diff}{--git} option to \hgcmd{diff}, it will %display \command{git}-compatible diffs that \emph{can} display this %extra information. \hgcmd{diff}$B%3%^%s%I$G(B\hgopt{diff}{--git}$B%*%W%7%g%s$r;H$C$F$$$k>l9g!$(B $B$3$N>pJs$rI=<($G$-$k(B\command{git}$B8_49$N(Bdiff$B$r=PNO$9$k!%(B %The second possible reason that \hgcmd{diff} might be printing diffs %for a subset of the files displayed by \hgcmd{status} is that if you %invoke it without any arguments, \hgcmd{diff} prints diffs against the %first parent of the working directory.If you have run \hgcmd{merge} %to merge two changesets, but you haven't yet committed the results of %the merge,your working directory has two parents (use \hgcmd{parents} %to see them).While \hgcmd{status} prints modifications relative to %\emph{both} parents after an uncommitted merge, \hgcmd{diff} still %operates relative only to the first parent. You can get it to print %diffs relative to the second parent by specifying that parent with the %\hgopt{diff}{-r} option. There is no way to print diffs relative to %both parents. 2$B$DL\$N9M$($i$l$kM}M3$O!$(B\hgcmd{diff}$B$r0z?t$J$7$G8F$s$G$$$k$?$a!$(B \hgcmd{diff}$B$,%o!<%-%s%0%G%#%l%/%H%j$ND>@\$N?F$H$N:9J,$r<h$C$F$$$k$?$a$G(B $B$"$k!%%A%'%s%8%;%C%H$r%^!<%8$9$k$?$a$K(B\hgcmd{merge}$B$r<B9T$9$k$H!$%o!<%-%s(B $B%0%G%#%l%/%H%j$O(B2$B$D$N?F$r;}$D$3$H$K$J$k!%!J?F$rI=<($9$k$K$O(B \hgcmd{parents}$B$r;H$&!%!K(B\hgcmd{status}$B$O%3%_%C%H$5$l$F$$$J$$%^!<%8$N(B \emph{$BN>J}(B}$B$N?F$H$N:9J,$r<h$k$N$KBP$7$F!$(B\hgcmd{diff}$B$O=g=xE*$K@h$N?F$H(B $B$N:9J,$r<h$k!%8e$N?F$H$N:9J,$r<h$k$?$a$K$O(B\hgopt{diff}{-r}$B%*%W%7%g%s$r;H(B $B$&!%N>J}$N?F$H$N:9J,$r<h$kJ}K!$OB8:_$7$J$$!%(B %\subsubsection{Generating safe binary diffs} \subsubsection{$B%P%$%J%j$N:9J,$r0BA4$K<hF@$9$k(B} %If you use the \hgopt{diff}{-a} option to force Mercurial to print %diffs of files that are either ``mostly text'' or contain lots of %binary data, those diffs cannot subsequently be applied by either %Mercurial's \hgcmd{import} command or the system's \command{patch} %command. $BBgH>$,%F%-%9%H$G$"$k%U%!%$%kF1;N$d!$B?$/$N%P%$%J%j%G!<%?$,4^$^$l$k%U%!%$(B $B%kF1;N$N:9J,$r<h$k$?$a$K(B\hgopt{diff}{-a}$B$r;XDj$9$k>l9g!$@8@.$5$l$?:9J,$O(B Mercurial$B$N(B\hgcmd{import}$B%3%^%s%I$d%7%9%F%`$N(B\command{patch}$B$KMQ$$$k$3$H(B $B$,$G$-$J$$!%(B %If you want to generate a diff of a binary file that is safe to use as %input for \hgcmd{import}, use the \hgcmd{diff}{--git} option when you %generate the patch. The system \command{patch} command cannot handle %binary patches at all. \hgcmd{import}$B$GMxMQ$G$-$k%P%$%J%j%U%!%$%k$N:9J,$r@8@.$9$k$K$O!$(B $B%Q%C%A@8@.$K(B\hgcmd{diff}{--git}$B%*%W%7%g%s$r;XDj$9$l$P$h$$!%%7%9%F%`$N(B \command{patch}$B%3%^%s%I$+$i$O$3$N:9J,$OMxMQ$G$-$J$$!%(B %%% Local Variables: %%% mode: yatex %%% TeX-master: "00book" %%% End: