hgbook

diff es/cmdref.tex @ 439:955f5218f63e

Reserving chapters to translate on weekend
author Igor TAmara <igor@tamarapatino.org>
date Sat Dec 06 00:16:59 2008 -0500 (2008-12-06)
parents 04c08ad7e92e
children 1b8b19825994
line diff
     1.1 --- a/es/cmdref.tex	Sat Oct 18 07:48:21 2008 -0500
     1.2 +++ b/es/cmdref.tex	Sat Dec 06 00:16:59 2008 -0500
     1.3 @@ -0,0 +1,176 @@
     1.4 +\chapter{Command reference}
     1.5 +\label{cmdref}
     1.6 +
     1.7 +\cmdref{add}{add files at the next commit}
     1.8 +\optref{add}{I}{include}
     1.9 +\optref{add}{X}{exclude}
    1.10 +\optref{add}{n}{dry-run}
    1.11 +
    1.12 +\cmdref{diff}{print changes in history or working directory}
    1.13 +
    1.14 +Show differences between revisions for the specified files or
    1.15 +directories, using the unified diff format.  For a description of the
    1.16 +unified diff format, see section~\ref{sec:mq:patch}.
    1.17 +
    1.18 +By default, this command does not print diffs for files that Mercurial
    1.19 +considers to contain binary data.  To control this behaviour, see the
    1.20 +\hgopt{diff}{-a} and \hgopt{diff}{--git} options.
    1.21 +
    1.22 +\subsection{Options}
    1.23 +
    1.24 +\loptref{diff}{nodates}
    1.25 +
    1.26 +Omit date and time information when printing diff headers.
    1.27 +
    1.28 +\optref{diff}{B}{ignore-blank-lines}
    1.29 +
    1.30 +Do not print changes that only insert or delete blank lines.  A line
    1.31 +that contains only whitespace is not considered blank.
    1.32 +
    1.33 +\optref{diff}{I}{include}
    1.34 +
    1.35 +Include files and directories whose names match the given patterns.
    1.36 +
    1.37 +\optref{diff}{X}{exclude}
    1.38 +
    1.39 +Exclude files and directories whose names match the given patterns.
    1.40 +
    1.41 +\optref{diff}{a}{text}
    1.42 +
    1.43 +If this option is not specified, \hgcmd{diff} will refuse to print
    1.44 +diffs for files that it detects as binary. Specifying \hgopt{diff}{-a}
    1.45 +forces \hgcmd{diff} to treat all files as text, and generate diffs for
    1.46 +all of them.
    1.47 +
    1.48 +This option is useful for files that are ``mostly text'' but have a
    1.49 +few embedded NUL characters.  If you use it on files that contain a
    1.50 +lot of binary data, its output will be incomprehensible.
    1.51 +
    1.52 +\optref{diff}{b}{ignore-space-change}
    1.53 +
    1.54 +Do not print a line if the only change to that line is in the amount
    1.55 +of white space it contains.
    1.56 +
    1.57 +\optref{diff}{g}{git}
    1.58 +
    1.59 +Print \command{git}-compatible diffs.  XXX reference a format
    1.60 +description.
    1.61 +
    1.62 +\optref{diff}{p}{show-function}
    1.63 +
    1.64 +Display the name of the enclosing function in a hunk header, using a
    1.65 +simple heuristic.  This functionality is enabled by default, so the
    1.66 +\hgopt{diff}{-p} option has no effect unless you change the value of
    1.67 +the \rcitem{diff}{showfunc} config item, as in the following example.
    1.68 +\interaction{cmdref.diff-p}
    1.69 +
    1.70 +\optref{diff}{r}{rev}
    1.71 +
    1.72 +Specify one or more revisions to compare.  The \hgcmd{diff} command
    1.73 +accepts up to two \hgopt{diff}{-r} options to specify the revisions to
    1.74 +compare.
    1.75 +
    1.76 +\begin{enumerate}
    1.77 +\setcounter{enumi}{0}
    1.78 +\item Display the differences between the parent revision of the
    1.79 +  working directory and the working directory.
    1.80 +\item Display the differences between the specified changeset and the
    1.81 +  working directory.
    1.82 +\item Display the differences between the two specified changesets.
    1.83 +\end{enumerate}
    1.84 +
    1.85 +You can specify two revisions using either two \hgopt{diff}{-r}
    1.86 +options or revision range notation.  For example, the two revision
    1.87 +specifications below are equivalent.
    1.88 +\begin{codesample2}
    1.89 +  hg diff -r 10 -r 20
    1.90 +  hg diff -r10:20
    1.91 +\end{codesample2}
    1.92 +
    1.93 +When you provide two revisions, Mercurial treats the order of those
    1.94 +revisions as significant.  Thus, \hgcmdargs{diff}{-r10:20} will
    1.95 +produce a diff that will transform files from their contents as of
    1.96 +revision~10 to their contents as of revision~20, while
    1.97 +\hgcmdargs{diff}{-r20:10} means the opposite: the diff that will
    1.98 +transform files from their revision~20 contents to their revision~10
    1.99 +contents.  You cannot reverse the ordering in this way if you are
   1.100 +diffing against the working directory.
   1.101 +
   1.102 +\optref{diff}{w}{ignore-all-space}
   1.103 +
   1.104 +\cmdref{version}{print version and copyright information}
   1.105 +
   1.106 +This command displays the version of Mercurial you are running, and
   1.107 +its copyright license.  There are four kinds of version string that
   1.108 +you may see.
   1.109 +\begin{itemize}
   1.110 +\item The string ``\texttt{unknown}''. This version of Mercurial was
   1.111 +  not built in a Mercurial repository, and cannot determine its own
   1.112 +  version.
   1.113 +\item A short numeric string, such as ``\texttt{1.1}''. This is a
   1.114 +  build of a revision of Mercurial that was identified by a specific
   1.115 +  tag in the repository where it was built.  (This doesn't necessarily
   1.116 +  mean that you're running an official release; someone else could
   1.117 +  have added that tag to any revision in the repository where they
   1.118 +  built Mercurial.)
   1.119 +\item A hexadecimal string, such as ``\texttt{875489e31abe}''.  This
   1.120 +  is a build of the given revision of Mercurial.
   1.121 +\item A hexadecimal string followed by a date, such as
   1.122 +  ``\texttt{875489e31abe+20070205}''.  This is a build of the given
   1.123 +  revision of Mercurial, where the build repository contained some
   1.124 +  local changes that had not been committed.
   1.125 +\end{itemize}
   1.126 +
   1.127 +\subsection{Tips and tricks}
   1.128 +
   1.129 +\subsubsection{Why do the results of \hgcmd{diff} and \hgcmd{status}
   1.130 +  differ?}
   1.131 +\label{cmdref:diff-vs-status}
   1.132 +
   1.133 +When you run the \hgcmd{status} command, you'll see a list of files
   1.134 +that Mercurial will record changes for the next time you perform a
   1.135 +commit.  If you run the \hgcmd{diff} command, you may notice that it
   1.136 +prints diffs for only a \emph{subset} of the files that \hgcmd{status}
   1.137 +listed.  There are two possible reasons for this.
   1.138 +
   1.139 +The first is that \hgcmd{status} prints some kinds of modifications
   1.140 +that \hgcmd{diff} doesn't normally display.  The \hgcmd{diff} command
   1.141 +normally outputs unified diffs, which don't have the ability to
   1.142 +represent some changes that Mercurial can track.  Most notably,
   1.143 +traditional diffs can't represent a change in whether or not a file is
   1.144 +executable, but Mercurial records this information.
   1.145 +
   1.146 +If you use the \hgopt{diff}{--git} option to \hgcmd{diff}, it will
   1.147 +display \command{git}-compatible diffs that \emph{can} display this
   1.148 +extra information.
   1.149 +
   1.150 +The second possible reason that \hgcmd{diff} might be printing diffs
   1.151 +for a subset of the files displayed by \hgcmd{status} is that if you
   1.152 +invoke it without any arguments, \hgcmd{diff} prints diffs against the
   1.153 +first parent of the working directory.  If you have run \hgcmd{merge}
   1.154 +to merge two changesets, but you haven't yet committed the results of
   1.155 +the merge, your working directory has two parents (use \hgcmd{parents}
   1.156 +to see them).  While \hgcmd{status} prints modifications relative to
   1.157 +\emph{both} parents after an uncommitted merge, \hgcmd{diff} still
   1.158 +operates relative only to the first parent.  You can get it to print
   1.159 +diffs relative to the second parent by specifying that parent with the
   1.160 +\hgopt{diff}{-r} option.  There is no way to print diffs relative to
   1.161 +both parents.
   1.162 +
   1.163 +\subsubsection{Generating safe binary diffs}
   1.164 +
   1.165 +If you use the \hgopt{diff}{-a} option to force Mercurial to print
   1.166 +diffs of files that are either ``mostly text'' or contain lots of
   1.167 +binary data, those diffs cannot subsequently be applied by either
   1.168 +Mercurial's \hgcmd{import} command or the system's \command{patch}
   1.169 +command.  
   1.170 +
   1.171 +If you want to generate a diff of a binary file that is safe to use as
   1.172 +input for \hgcmd{import}, use the \hgcmd{diff}{--git} option when you
   1.173 +generate the patch.  The system \command{patch} command cannot handle
   1.174 +binary patches at all.
   1.175 +
   1.176 +%%% Local Variables: 
   1.177 +%%% mode: latex
   1.178 +%%% TeX-master: "00book"
   1.179 +%%% End: