| 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>extdiff</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="extdiff"> |
| 12 |
<span id="ext-extdiff"></span> |
| 13 |
<h1 class="title">extdiff</h1> |
| 14 |
|
| 15 |
<div class="contents htmlonly topic" id="contents"> |
| 16 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 17 |
<ul class="simple"> |
| 18 |
<li><a class="reference internal" href="#description" id="toc-entry-1">Description</a></li> |
| 19 |
<li><a class="reference internal" href="#commands" id="toc-entry-2">Commands</a><ul> |
| 20 |
<li><a class="reference internal" href="#file-content-management" id="toc-entry-3">File content management</a></li> |
| 21 |
</ul> |
| 22 |
</li> |
| 23 |
</ul> |
| 24 |
</div> |
| 25 |
<p>command to allow external programs to compare revisions</p> |
| 26 |
<div class="section" id="description"> |
| 27 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 28 |
<p>The extdiff Mercurial extension allows you to use external programs |
| 29 |
to compare revisions, or revision with working directory. The external |
| 30 |
diff programs are called with a configurable set of options and two |
| 31 |
non-option arguments: paths to directories containing snapshots of |
| 32 |
files to compare.</p> |
| 33 |
<p>If there is more than one file being compared and the "child" revision |
| 34 |
is the working directory, any modifications made in the external diff |
| 35 |
program will be copied back to the working directory from the temporary |
| 36 |
directory.</p> |
| 37 |
<p>The extdiff extension also allows you to configure new diff commands, so |
| 38 |
you do not need to type <a class="reference external" href="hg-extdiff.html"><tt class="docutils literal">hg extdiff <span class="pre">-p</span> kdiff3</tt></a> always.</p> |
| 39 |
<pre class="literal-block"> |
| 40 |
[extdiff] |
| 41 |
# add new command that runs GNU diff(1) in 'context diff' mode |
| 42 |
cdiff = gdiff -Nprc5 |
| 43 |
## or the old way: |
| 44 |
#cmd.cdiff = gdiff |
| 45 |
#opts.cdiff = -Nprc5 |
| 46 |
|
| 47 |
# add new command called meld, runs meld (no need to name twice). If |
| 48 |
# the meld executable is not available, the meld tool in [merge-tools] |
| 49 |
# will be used, if available |
| 50 |
meld = |
| 51 |
|
| 52 |
# add new command called vimdiff, runs gvimdiff with DirDiff plugin |
| 53 |
# (see http://www.vim.org/scripts/script.php?script_id=102) Non |
| 54 |
# English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in |
| 55 |
# your .vimrc |
| 56 |
vimdiff = gvim -f "+next" \ |
| 57 |
"+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
| 58 |
</pre> |
| 59 |
<p>Tool arguments can include variables that are expanded at runtime:</p> |
| 60 |
<pre class="literal-block"> |
| 61 |
$parent1, $plabel1 - filename, descriptive label of first parent |
| 62 |
$child, $clabel - filename, descriptive label of child revision |
| 63 |
$parent2, $plabel2 - filename, descriptive label of second parent |
| 64 |
$root - repository root |
| 65 |
$parent is an alias for $parent1. |
| 66 |
</pre> |
| 67 |
<p>The extdiff extension will look in your [diff-tools] and [merge-tools] |
| 68 |
sections for diff tool arguments, when none are specified in [extdiff].</p> |
| 69 |
<pre class="literal-block"> |
| 70 |
[extdiff] |
| 71 |
kdiff3 = |
| 72 |
|
| 73 |
[diff-tools] |
| 74 |
kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
| 75 |
</pre> |
| 76 |
<p>If a program has a graphical interface, it might be interesting to tell |
| 77 |
Mercurial about it. It will prevent the program from being mistakenly |
| 78 |
used in a terminal-only environment (such as an SSH terminal session), |
| 79 |
and will make <a class="reference external" href="hg-extdiff.html"><tt class="docutils literal">hg extdiff <span class="pre">--per-file</span></tt></a> open multiple file diffs at once |
| 80 |
instead of one by one (if you still want to open file diffs one by one, |
| 81 |
you can use the --confirm option).</p> |
| 82 |
<p>Declaring that a tool has a graphical interface can be done with the |
| 83 |
<tt class="docutils literal">gui</tt> flag next to where <tt class="docutils literal">diffargs</tt> are specified:</p> |
| 84 |
<pre class="literal-block"> |
| 85 |
[diff-tools] |
| 86 |
kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child |
| 87 |
kdiff3.gui = true |
| 88 |
</pre> |
| 89 |
<p>You can use -I/-X and list of file or directory names like normal |
| 90 |
<a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff</tt></a> command. The extdiff extension makes snapshots of only |
| 91 |
needed files, so running the external diff program will actually be |
| 92 |
pretty fast (at least faster than having to compare the entire tree).</p> |
| 93 |
</div> |
| 94 |
<div class="section" id="commands"> |
| 95 |
<h1><a class="toc-backref" href="#contents">Commands</a></h1> |
| 96 |
<div class="section" id="file-content-management"> |
| 97 |
<h2><a class="toc-backref" href="#contents">File content management</a></h2> |
| 98 |
<div class="section" id="extdiff-1"> |
| 99 |
<h3>extdiff</h3> |
| 100 |
<p>use external program to diff repository (or selected files):</p> |
| 101 |
<pre class="literal-block"> |
| 102 |
hg extdiff [OPT]... [FILE]... |
| 103 |
</pre> |
| 104 |
<p>Show differences between revisions for the specified files, using |
| 105 |
an external program. The default program used is diff, with |
| 106 |
default options "-Npru".</p> |
| 107 |
<p>To select a different program, use the -p/--program option. The |
| 108 |
program will be passed the names of two directories to compare, |
| 109 |
unless the --per-file option is specified (see below). To pass |
| 110 |
additional options to the program, use -o/--option. These will be |
| 111 |
passed before the names of the directories or files to compare.</p> |
| 112 |
<p>The --from, --to, and --change options work the same way they do for |
| 113 |
<a class="reference external" href="hg-diff.html"><tt class="docutils literal">hg diff</tt></a>.</p> |
| 114 |
<p>The --per-file option runs the external program repeatedly on each |
| 115 |
file to diff, instead of once on two directories. By default, |
| 116 |
this happens one by one, where the next file diff is open in the |
| 117 |
external program only once the previous external program (for the |
| 118 |
previous file diff) has exited. If the external program has a |
| 119 |
graphical interface, it can open all the file diffs at once instead |
| 120 |
of one by one. See <a class="reference external" href="hg.1.html#-e"><tt class="docutils literal">hg help <span class="pre">-e</span> extdiff</tt></a> for information about how |
| 121 |
to tell Mercurial that a given program has a graphical interface.</p> |
| 122 |
<p>The --confirm option will prompt the user before each invocation of |
| 123 |
the external program. It is ignored if --per-file isn't specified.</p> |
| 124 |
<p>Options:</p> |
| 125 |
<table class="docutils option-list" frame="void" rules="none"> |
| 126 |
<col class="option" /> |
| 127 |
<col class="description" /> |
| 128 |
<tbody valign="top"> |
| 129 |
<tr><td class="option-group" colspan="2"> |
| 130 |
<kbd><span class="option">-p</span>, <span class="option">--program <var><CMD></var></span></kbd></td> |
| 131 |
</tr> |
| 132 |
<tr><td> </td><td>comparison program to run</td></tr> |
| 133 |
<tr><td class="option-group" colspan="2"> |
| 134 |
<kbd><span class="option">-o</span>, <span class="option">--option <var><OPT[+]></var></span></kbd></td> |
| 135 |
</tr> |
| 136 |
<tr><td> </td><td>pass option to comparison program</td></tr> |
| 137 |
<tr><td class="option-group" colspan="2"> |
| 138 |
<kbd><span class="option">-r</span>, <span class="option">--rev <var><REV[+]></var></span></kbd></td> |
| 139 |
</tr> |
| 140 |
<tr><td> </td><td>revision (DEPRECATED)</td></tr> |
| 141 |
<tr><td class="option-group"> |
| 142 |
<kbd><span class="option">--from <var><REV1></var></span></kbd></td> |
| 143 |
<td>revision to diff from</td></tr> |
| 144 |
<tr><td class="option-group"> |
| 145 |
<kbd><span class="option">--to <var><REV2></var></span></kbd></td> |
| 146 |
<td>revision to diff to</td></tr> |
| 147 |
<tr><td class="option-group" colspan="2"> |
| 148 |
<kbd><span class="option">-c</span>, <span class="option">--change <var><REV></var></span></kbd></td> |
| 149 |
</tr> |
| 150 |
<tr><td> </td><td>change made by revision</td></tr> |
| 151 |
<tr><td class="option-group"> |
| 152 |
<kbd><span class="option">--per-file</span></kbd></td> |
| 153 |
<td>compare each file instead of revision snapshots</td></tr> |
| 154 |
<tr><td class="option-group"> |
| 155 |
<kbd><span class="option">--confirm</span></kbd></td> |
| 156 |
<td>prompt user before each external program invocation</td></tr> |
| 157 |
<tr><td class="option-group"> |
| 158 |
<kbd><span class="option">--patch</span></kbd></td> |
| 159 |
<td>compare patches for two revisions</td></tr> |
| 160 |
<tr><td class="option-group" colspan="2"> |
| 161 |
<kbd><span class="option">-I</span>, <span class="option">--include <var><PATTERN[+]></var></span></kbd></td> |
| 162 |
</tr> |
| 163 |
<tr><td> </td><td>include names matching the given patterns</td></tr> |
| 164 |
<tr><td class="option-group" colspan="2"> |
| 165 |
<kbd><span class="option">-X</span>, <span class="option">--exclude <var><PATTERN[+]></var></span></kbd></td> |
| 166 |
</tr> |
| 167 |
<tr><td> </td><td>exclude names matching the given patterns</td></tr> |
| 168 |
<tr><td class="option-group"> |
| 169 |
<kbd><span class="option">-S</span>, <span class="option">--subrepos</span></kbd></td> |
| 170 |
<td>recurse into subrepositories</td></tr> |
| 171 |
</tbody> |
| 172 |
</table> |
| 173 |
<p>[+] marked option can be specified multiple times</p> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
</body> |
| 179 |
</html> |