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