view ja/cmdref.tex @ 292:f72e4be6dd37

intermediate commit.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Thu, 07 Feb 2008 18:56:42 +0900
parents 504f23b4f625
children b2d447356c42
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}{ignore-blank-lines}

%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$J$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(BNUL$BJ8;z$r4^$s$G$$$k$h$&$J%U%!(B
$B%$%k$KBP$7$FM-MQ$G$"$k!%$3$N%*%W%7%g%s$r%P%$%J%j%G!<%?$,B?$/4^$^$l$k%U%!(B
$B%$%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$J$&!%$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.

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.

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.

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.

\subsubsection{Generating safe binary diffs}

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.  

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.

%%% Local Variables: 
%%% mode: yatex
%%% TeX-master: "00book"
%%% End: