| 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>Diff Formats</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="diff-formats"> |
| 12 |
<span id="topic-diffs"></span> |
| 13 |
<h1 class="title">Diff Formats</h1> |
| 14 |
|
| 15 |
<p id="diffs">Mercurial's default format for showing changes between two versions of |
| 16 |
a file is compatible with the unified format of GNU diff, which can be |
| 17 |
used by GNU patch and many other standard tools.</p> |
| 18 |
<p>While this standard format is often enough, it does not encode the |
| 19 |
following information:</p> |
| 20 |
<ul class="simple"> |
| 21 |
<li>executable status and other permission bits</li> |
| 22 |
<li>copy or rename information</li> |
| 23 |
<li>changes in binary files</li> |
| 24 |
<li>creation or deletion of empty files</li> |
| 25 |
</ul> |
| 26 |
<p>Mercurial also supports the extended diff format from the git VCS |
| 27 |
which addresses these limitations. The git diff format is not produced |
| 28 |
by default because a few widespread tools still do not understand this |
| 29 |
format.</p> |
| 30 |
<p>This means that when generating diffs from a Mercurial repository |
| 31 |
(e.g. with <a class="reference external" href="hg-export.html"><tt class="docutils literal">hg export</tt></a>), you should be careful about things like file |
| 32 |
copies and renames or other things mentioned above, because when |
| 33 |
applying a standard diff to a different repository, this extra |
| 34 |
information is lost. Mercurial's internal operations (like push and |
| 35 |
pull) are not affected by this, because they use an internal binary |
| 36 |
format for communicating changes.</p> |
| 37 |
<p>To make Mercurial produce the git extended diff format, use the --git |
| 38 |
option available for many commands, or set 'git = True' in the [diff] |
| 39 |
section of your configuration file. You do not need to set this option |
| 40 |
when importing diffs in this format or using them in the mq extension.</p> |
| 41 |
</div> |
| 42 |
</body> |
| 43 |
</html> |