Mercurial > hgbook
annotate en/cmdref.tex @ 576:1f9ef8b3ab79
translated a bit of the hook reference
author | Javier Rojas <jerojasro@devnull.li> |
---|---|
date | Fri, 02 Jan 2009 22:30:00 -0500 |
parents | 92660e72d6bf |
children |
rev | line source |
---|---|
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1 \chapter{Command reference} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
2 \label{cmdref} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
4 \cmdref{add}{add files at the next commit} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
5 \optref{add}{I}{include} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
6 \optref{add}{X}{exclude} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
7 \optref{add}{n}{dry-run} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
8 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
9 \cmdref{diff}{print changes in history or working directory} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
10 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 Show differences between revisions for the specified files or |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
12 directories, using the unified diff format. For a description of the |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 unified diff format, see section~\ref{sec:mq:patch}. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
14 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
15 By default, this command does not print diffs for files that Mercurial |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
16 considers to contain binary data. To control this behaviour, see the |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
17 \hgopt{diff}{-a} and \hgopt{diff}{--git} options. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
18 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
19 \subsection{Options} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
20 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
21 \loptref{diff}{nodates} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
22 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
23 Omit date and time information when printing diff headers. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
24 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
25 \optref{diff}{B}{ignore-blank-lines} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
27 Do not print changes that only insert or delete blank lines. A line |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
28 that contains only whitespace is not considered blank. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
29 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
30 \optref{diff}{I}{include} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
31 |
276
92660e72d6bf
[hgbook] Fix a typo
"Dongsheng Song" <dongsheng.song@gmail.com>
parents:
133
diff
changeset
|
32 Include files and directories whose names match the given patterns. |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
33 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
34 \optref{diff}{X}{exclude} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
35 |
276
92660e72d6bf
[hgbook] Fix a typo
"Dongsheng Song" <dongsheng.song@gmail.com>
parents:
133
diff
changeset
|
36 Exclude files and directories whose names match the given patterns. |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
37 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
38 \optref{diff}{a}{text} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
39 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
40 If this option is not specified, \hgcmd{diff} will refuse to print |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
41 diffs for files that it detects as binary. Specifying \hgopt{diff}{-a} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
42 forces \hgcmd{diff} to treat all files as text, and generate diffs for |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
43 all of them. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
44 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
45 This option is useful for files that are ``mostly text'' but have a |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
46 few embedded NUL characters. If you use it on files that contain a |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
47 lot of binary data, its output will be incomprehensible. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
48 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
49 \optref{diff}{b}{ignore-space-change} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
50 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
51 Do not print a line if the only change to that line is in the amount |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
52 of white space it contains. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
53 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
54 \optref{diff}{g}{git} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
55 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
56 Print \command{git}-compatible diffs. XXX reference a format |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
57 description. |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
59 \optref{diff}{p}{show-function} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
60 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
61 Display the name of the enclosing function in a hunk header, using a |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
62 simple heuristic. This functionality is enabled by default, so the |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
63 \hgopt{diff}{-p} option has no effect unless you change the value of |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
64 the \rcitem{diff}{showfunc} config item, as in the following example. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
65 \interaction{cmdref.diff-p} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
66 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
67 \optref{diff}{r}{rev} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
68 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
69 Specify one or more revisions to compare. The \hgcmd{diff} command |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
70 accepts up to two \hgopt{diff}{-r} options to specify the revisions to |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
71 compare. |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
72 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
73 \begin{enumerate} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 \setcounter{enumi}{0} |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
75 \item Display the differences between the parent revision of the |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
76 working directory and the working directory. |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
77 \item Display the differences between the specified changeset and the |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
78 working directory. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 \item Display the differences between the two specified changesets. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
80 \end{enumerate} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
81 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
82 You can specify two revisions using either two \hgopt{diff}{-r} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
83 options or revision range notation. For example, the two revision |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
84 specifications below are equivalent. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
85 \begin{codesample2} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
86 hg diff -r 10 -r 20 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
87 hg diff -r10:20 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
88 \end{codesample2} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
89 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
90 When you provide two revisions, Mercurial treats the order of those |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
91 revisions as significant. Thus, \hgcmdargs{diff}{-r10:20} will |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
92 produce a diff that will transform files from their contents as of |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
93 revision~10 to their contents as of revision~20, while |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
94 \hgcmdargs{diff}{-r20:10} means the opposite: the diff that will |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
95 transform files from their revision~20 contents to their revision~10 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
96 contents. You cannot reverse the ordering in this way if you are |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
97 diffing against the working directory. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
98 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
99 \optref{diff}{w}{ignore-all-space} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
100 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
101 \cmdref{version}{print version and copyright information} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
102 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
103 This command displays the version of Mercurial you are running, and |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
104 its copyright license. There are four kinds of version string that |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
105 you may see. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
106 \begin{itemize} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
107 \item The string ``\texttt{unknown}''. This version of Mercurial was |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
108 not built in a Mercurial repository, and cannot determine its own |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
109 version. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
110 \item A short numeric string, such as ``\texttt{1.1}''. This is a |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
111 build of a revision of Mercurial that was identified by a specific |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
112 tag in the repository where it was built. (This doesn't necessarily |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
113 mean that you're running an official release; someone else could |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
114 have added that tag to any revision in the repository where they |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
115 built Mercurial.) |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
116 \item A hexadecimal string, such as ``\texttt{875489e31abe}''. This |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
117 is a build of the given revision of Mercurial. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
118 \item A hexadecimal string followed by a date, such as |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
119 ``\texttt{875489e31abe+20070205}''. This is a build of the given |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
120 revision of Mercurial, where the build repository contained some |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
121 local changes that had not been committed. |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
122 \end{itemize} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
123 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
124 \subsection{Tips and tricks} |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
125 |
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
126 \subsubsection{Why do the results of \hgcmd{diff} and \hgcmd{status} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
127 differ?} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
128 \label{cmdref:diff-vs-status} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
129 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
130 When you run the \hgcmd{status} command, you'll see a list of files |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
131 that Mercurial will record changes for the next time you perform a |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
132 commit. If you run the \hgcmd{diff} command, you may notice that it |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
133 prints diffs for only a \emph{subset} of the files that \hgcmd{status} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
134 listed. There are two possible reasons for this. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
135 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
136 The first is that \hgcmd{status} prints some kinds of modifications |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
137 that \hgcmd{diff} doesn't normally display. The \hgcmd{diff} command |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
138 normally outputs unified diffs, which don't have the ability to |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
139 represent some changes that Mercurial can track. Most notably, |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
140 traditional diffs can't represent a change in whether or not a file is |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
141 executable, but Mercurial records this information. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
142 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
143 If you use the \hgopt{diff}{--git} option to \hgcmd{diff}, it will |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
144 display \command{git}-compatible diffs that \emph{can} display this |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
145 extra information. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
146 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
147 The second possible reason that \hgcmd{diff} might be printing diffs |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
148 for a subset of the files displayed by \hgcmd{status} is that if you |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
149 invoke it without any arguments, \hgcmd{diff} prints diffs against the |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
150 first parent of the working directory. If you have run \hgcmd{merge} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
151 to merge two changesets, but you haven't yet committed the results of |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
152 the merge, your working directory has two parents (use \hgcmd{parents} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
153 to see them). While \hgcmd{status} prints modifications relative to |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
154 \emph{both} parents after an uncommitted merge, \hgcmd{diff} still |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
155 operates relative only to the first parent. You can get it to print |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
156 diffs relative to the second parent by specifying that parent with the |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
157 \hgopt{diff}{-r} option. There is no way to print diffs relative to |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
158 both parents. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
159 |
133
1e013fbe35f7
Lots of filename related content. A little more command reference
Bryan O'Sullivan <bos@serpentine.com>
parents:
132
diff
changeset
|
160 \subsubsection{Generating safe binary diffs} |
132
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
161 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
162 If you use the \hgopt{diff}{-a} option to force Mercurial to print |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
163 diffs of files that are either ``mostly text'' or contain lots of |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
164 binary data, those diffs cannot subsequently be applied by either |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
165 Mercurial's \hgcmd{import} command or the system's \command{patch} |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
166 command. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
167 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
168 If you want to generate a diff of a binary file that is safe to use as |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
169 input for \hgcmd{import}, use the \hgcmd{diff}{--git} option when you |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
170 generate the patch. The system \command{patch} command cannot handle |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
171 binary patches at all. |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
172 |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
173 %%% Local Variables: |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
174 %%% mode: latex |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
175 %%% TeX-master: "00book" |
e1e2f3e0256a
Start command reference, with the diff command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
176 %%% End: |