Debian Codegraph @

doc/html/hg-diff.html

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" />
7 <title>hg diff</title>
8 <link rel="stylesheet" href="../style.css" type="text/css" />
9 </head>
10 <body>
11 <div class="document" id="hg-diff">
12 <span id="hg-diff-1"></span>
13 <h1 class="title">hg diff</h1>
14 <h2 class="subtitle" id="diff-repository-or-selected-files">diff repository (or selected files)</h2>
15
16 <div class="contents htmlonly topic" id="contents">
17 <p class="topic-title"><a class="reference internal" href="#top">Contents</a></p>
18 <ul class="simple">
19 <li><a class="reference internal" href="#synopsis" id="toc-entry-1">Synopsis</a></li>
20 <li><a class="reference internal" href="#description" id="toc-entry-2">Description</a></li>
21 <li><a class="reference internal" href="#options" id="toc-entry-3">Options</a></li>
22 </ul>
23 </div>
24 <div class="section" id="synopsis">
25 <h1><a class="toc-backref" href="#contents">Synopsis</a></h1>
26 <pre class="literal-block">
27 hg diff [OPTION]... ([-c REV] | [--from REV1] [--to REV2]) [FILE]...
28 </pre>
29 </div>
30 <div class="section" id="description">
31 <h1><a class="toc-backref" href="#contents">Description</a></h1>
32 <p>Show differences between revisions for the specified files.</p>
33 <p>Differences between files are shown using the unified diff format.</p>
34 <div class="admonition note">
35 <p class="first admonition-title">Note</p>
36 <p class="last"><a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff</tt></a> may generate unexpected results for merges, as it will
37 default to comparing against the working directory's first
38 parent changeset if no revisions are specified. To diff against the
39 conflict regions, you can use <cite>--config diff.merge=yes</cite>.</p>
40 </div>
41 <p>By default, the working directory files are compared to its first parent. To
42 see the differences from another revision, use --from. To see the difference
43 to another revision, use --to. For example, <a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff <span class="pre">--from</span> .^</tt></a> will show
44 the differences from the working copy's grandparent to the working copy,
45 <a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff <span class="pre">--to</span> .</tt></a> will show the diff from the working copy to its parent
46 (i.e. the reverse of the default), and <a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff <span class="pre">--from</span> 1.0 <span class="pre">--to</span> 1.2</tt></a> will
47 show the diff between those two revisions.</p>
48 <p>Alternatively you can specify -c/--change with a revision to see the changes
49 in that changeset relative to its first parent (i.e. <a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff <span class="pre">-c</span> 42</tt></a> is
50 equivalent to <a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff <span class="pre">--from</span> 42^ <span class="pre">--to</span> 42</tt></a>)</p>
51 <p>Without the -a/--text option, diff will avoid generating diffs of
52 files it detects as binary. With -a, diff will generate a diff
53 anyway, probably with undesirable results.</p>
54 <p>Use the -g/--git option to generate diffs in the git extended diff
55 format. For more information, read <a class="reference external" href="topic-diffs.html"><tt class="docutils literal">hg help diffs</tt></a>.</p>
56 <div class="verbose docutils container">
57 <p>Examples:</p>
58 <ul>
59 <li><p class="first">compare a file in the current working directory to its parent:</p>
60 <pre class="literal-block">
61 hg diff foo.c
62 </pre>
63 </li>
64 <li><p class="first">compare two historical versions of a directory, with rename info:</p>
65 <pre class="literal-block">
66 hg diff --git --from 1.0 --to 1.2 lib/
67 </pre>
68 </li>
69 <li><p class="first">get change stats relative to the last change on some date:</p>
70 <pre class="literal-block">
71 hg diff --stat --from &quot;date('may 2')&quot;
72 </pre>
73 </li>
74 <li><p class="first">diff all newly-added files that contain a keyword:</p>
75 <pre class="literal-block">
76 hg diff &quot;set:added() and grep(GNU)&quot;
77 </pre>
78 </li>
79 <li><p class="first">compare a revision and its parents:</p>
80 <pre class="literal-block">
81 hg diff -c 9353 # compare against first parent
82 hg diff --from 9353^ --to 9353 # same using revset syntax
83 hg diff --from 9353^2 --to 9353 # compare against the second parent
84 </pre>
85 </li>
86 </ul>
87 </div>
88 <p>Returns 0 on success.</p>
89 </div>
90 <div class="section" id="options">
91 <h1><a class="toc-backref" href="#contents">Options</a></h1>
92 <table class="docutils option-list" frame="void" rules="none">
93 <col class="option" />
94 <col class="description" />
95 <tbody valign="top">
96 <tr><td class="option-group" colspan="2">
97 <kbd><span class="option">-r</span>, <span class="option">--rev <var>&lt;REV[+]&gt;</var></span></kbd></td>
98 </tr>
99 <tr><td>&nbsp;</td><td>revision (DEPRECATED)</td></tr>
100 <tr><td class="option-group">
101 <kbd><span class="option">--from <var>&lt;REV1&gt;</var></span></kbd></td>
102 <td>revision to diff from</td></tr>
103 <tr><td class="option-group">
104 <kbd><span class="option">--to <var>&lt;REV2&gt;</var></span></kbd></td>
105 <td>revision to diff to</td></tr>
106 <tr><td class="option-group" colspan="2">
107 <kbd><span class="option">-c</span>, <span class="option">--change <var>&lt;REV&gt;</var></span></kbd></td>
108 </tr>
109 <tr><td>&nbsp;</td><td>change made by revision</td></tr>
110 <tr><td class="option-group" colspan="2">
111 <kbd><span class="option">--ignore-changes-from-ancestors</span></kbd></td>
112 </tr>
113 <tr><td>&nbsp;</td><td>only compare the change made by the selected revision (EXPERIMENTAL)</td></tr>
114 <tr><td class="option-group">
115 <kbd><span class="option">-a</span>, <span class="option">--text</span></kbd></td>
116 <td>treat all files as text</td></tr>
117 <tr><td class="option-group">
118 <kbd><span class="option">-g</span>, <span class="option">--git</span></kbd></td>
119 <td>use git extended diff format (DEFAULT: diff.git)</td></tr>
120 <tr><td class="option-group">
121 <kbd><span class="option">--binary</span></kbd></td>
122 <td>generate binary diffs in git mode (default)</td></tr>
123 <tr><td class="option-group">
124 <kbd><span class="option">--nodates</span></kbd></td>
125 <td>omit dates from diff headers</td></tr>
126 <tr><td class="option-group">
127 <kbd><span class="option">--noprefix</span></kbd></td>
128 <td>omit a/ and b/ prefixes from filenames</td></tr>
129 <tr><td class="option-group" colspan="2">
130 <kbd><span class="option">-p</span>, <span class="option">--show-function</span></kbd></td>
131 </tr>
132 <tr><td>&nbsp;</td><td>show which function each change is in (DEFAULT: diff.showfunc)</td></tr>
133 <tr><td class="option-group">
134 <kbd><span class="option">--reverse</span></kbd></td>
135 <td>produce a diff that undoes the changes</td></tr>
136 <tr><td class="option-group" colspan="2">
137 <kbd><span class="option">-w</span>, <span class="option">--ignore-all-space</span></kbd></td>
138 </tr>
139 <tr><td>&nbsp;</td><td>ignore white space when comparing lines</td></tr>
140 <tr><td class="option-group" colspan="2">
141 <kbd><span class="option">-b</span>, <span class="option">--ignore-space-change</span></kbd></td>
142 </tr>
143 <tr><td>&nbsp;</td><td>ignore changes in the amount of white space</td></tr>
144 <tr><td class="option-group" colspan="2">
145 <kbd><span class="option">-B</span>, <span class="option">--ignore-blank-lines</span></kbd></td>
146 </tr>
147 <tr><td>&nbsp;</td><td>ignore changes whose lines are all blank</td></tr>
148 <tr><td class="option-group" colspan="2">
149 <kbd><span class="option">-Z</span>, <span class="option">--ignore-space-at-eol</span></kbd></td>
150 </tr>
151 <tr><td>&nbsp;</td><td>ignore changes in whitespace at EOL</td></tr>
152 <tr><td class="option-group" colspan="2">
153 <kbd><span class="option">-U</span>, <span class="option">--unified <var>&lt;NUM&gt;</var></span></kbd></td>
154 </tr>
155 <tr><td>&nbsp;</td><td>number of lines of context to show</td></tr>
156 <tr><td class="option-group">
157 <kbd><span class="option">--stat</span></kbd></td>
158 <td>output diffstat-style summary of changes</td></tr>
159 <tr><td class="option-group">
160 <kbd><span class="option">--root <var>&lt;DIR&gt;</var></span></kbd></td>
161 <td>produce diffs relative to subdirectory</td></tr>
162 <tr><td class="option-group" colspan="2">
163 <kbd><span class="option">-I</span>, <span class="option">--include <var>&lt;PATTERN[+]&gt;</var></span></kbd></td>
164 </tr>
165 <tr><td>&nbsp;</td><td>include names matching the given patterns</td></tr>
166 <tr><td class="option-group" colspan="2">
167 <kbd><span class="option">-X</span>, <span class="option">--exclude <var>&lt;PATTERN[+]&gt;</var></span></kbd></td>
168 </tr>
169 <tr><td>&nbsp;</td><td>exclude names matching the given patterns</td></tr>
170 <tr><td class="option-group">
171 <kbd><span class="option">-S</span>, <span class="option">--subrepos</span></kbd></td>
172 <td>recurse into subrepositories</td></tr>
173 </tbody>
174 </table>
175 <p>[+] marked option can be specified multiple times</p>
176 </div>
177 </div>
178 </body>
179 </html>