| 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 export</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="hg-export"> |
| 12 |
<span id="hg-export-1"></span> |
| 13 |
<h1 class="title">hg export</h1> |
| 14 |
<h2 class="subtitle" id="dump-the-header-and-diffs-for-one-or-more-changesets">dump the header and diffs for one or more changesets</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 export [OPTION]... [-o OUTFILESPEC] [-r] [REV]... |
| 28 |
</pre> |
| 29 |
</div> |
| 30 |
<div class="section" id="description"> |
| 31 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 32 |
<p>Print the changeset header and diffs for one or more revisions. |
| 33 |
If no revision is given, the parent of the working directory is used.</p> |
| 34 |
<p>The information shown in the changeset header is: author, date, |
| 35 |
branch name (if non-default), changeset hash, parent(s) and commit |
| 36 |
comment.</p> |
| 37 |
<div class="admonition note"> |
| 38 |
<p class="first admonition-title">Note</p> |
| 39 |
<p class="last"><a class="reference external" href="hg-export.html"><tt class="docutils literal">hg export</tt></a> may generate unexpected diff output for merge |
| 40 |
changesets, as it will compare the merge changeset against its |
| 41 |
first parent only.</p> |
| 42 |
</div> |
| 43 |
<p>Output may be to a file, in which case the name of the file is |
| 44 |
given using a template string. See <a class="reference external" href="hg.1.html#templates"><tt class="docutils literal">hg help templates</tt></a>. In addition |
| 45 |
to the common template keywords, the following formatting rules are |
| 46 |
supported:</p> |
| 47 |
<table class="docutils field-list" frame="void" rules="none"> |
| 48 |
<col class="field-name" /> |
| 49 |
<col class="field-body" /> |
| 50 |
<tbody valign="top"> |
| 51 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%%</tt>:</th><td class="field-body">literal "%" character</td> |
| 52 |
</tr> |
| 53 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%H</tt>:</th><td class="field-body">changeset hash (40 hexadecimal digits)</td> |
| 54 |
</tr> |
| 55 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%N</tt>:</th><td class="field-body">number of patches being generated</td> |
| 56 |
</tr> |
| 57 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%R</tt>:</th><td class="field-body">changeset revision number</td> |
| 58 |
</tr> |
| 59 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%b</tt>:</th><td class="field-body">basename of the exporting repository</td> |
| 60 |
</tr> |
| 61 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%h</tt>:</th><td class="field-body">short-form changeset hash (12 hexadecimal digits)</td> |
| 62 |
</tr> |
| 63 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%m</tt>:</th><td class="field-body">first line of the commit message (only alphanumeric characters)</td> |
| 64 |
</tr> |
| 65 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%n</tt>:</th><td class="field-body">zero-padded sequence number, starting at 1</td> |
| 66 |
</tr> |
| 67 |
<tr class="field"><th class="field-name"><tt class="docutils literal">%r</tt>:</th><td class="field-body">zero-padded changeset revision number</td> |
| 68 |
</tr> |
| 69 |
<tr class="field"><th class="field-name"><tt class="docutils literal">\</tt>:</th><td class="field-body">literal "" character</td> |
| 70 |
</tr> |
| 71 |
</tbody> |
| 72 |
</table> |
| 73 |
<p>Without the -a/--text option, export will avoid generating diffs |
| 74 |
of files it detects as binary. With -a, export will generate a |
| 75 |
diff anyway, probably with undesirable results.</p> |
| 76 |
<p>With -B/--bookmark changesets reachable by the given bookmark are |
| 77 |
selected.</p> |
| 78 |
<p>Use the -g/--git option to generate diffs in the git extended diff |
| 79 |
format. See <a class="reference external" href="topic-diffs.html"><tt class="docutils literal">hg help diffs</tt></a> for more information.</p> |
| 80 |
<p>With the --switch-parent option, the diff will be against the |
| 81 |
second parent. It can be useful to review a merge.</p> |
| 82 |
<div class="verbose docutils container"> |
| 83 |
<p>Template:</p> |
| 84 |
<p>The following keywords are supported in addition to the common template |
| 85 |
keywords and functions. See also <a class="reference external" href="hg.1.html#templates"><tt class="docutils literal">hg help templates</tt></a>.</p> |
| 86 |
<table class="docutils field-list" frame="void" rules="none"> |
| 87 |
<col class="field-name" /> |
| 88 |
<col class="field-body" /> |
| 89 |
<tbody valign="top"> |
| 90 |
<tr class="field"><th class="field-name">diff:</th><td class="field-body">String. Diff content.</td> |
| 91 |
</tr> |
| 92 |
<tr class="field"><th class="field-name">parents:</th><td class="field-body">List of strings. Parent nodes of the changeset.</td> |
| 93 |
</tr> |
| 94 |
</tbody> |
| 95 |
</table> |
| 96 |
<p>Examples:</p> |
| 97 |
<ul> |
| 98 |
<li><p class="first">use export and import to transplant a bugfix to the current |
| 99 |
branch:</p> |
| 100 |
<pre class="literal-block"> |
| 101 |
hg export -r 9353 | hg import - |
| 102 |
</pre> |
| 103 |
</li> |
| 104 |
<li><p class="first">export all the changesets between two revisions to a file with |
| 105 |
rename information:</p> |
| 106 |
<pre class="literal-block"> |
| 107 |
hg export --git -r 123:150 > changes.txt |
| 108 |
</pre> |
| 109 |
</li> |
| 110 |
<li><p class="first">split outgoing changes into a series of patches with |
| 111 |
descriptive names:</p> |
| 112 |
<pre class="literal-block"> |
| 113 |
hg export -r "outgoing()" -o "%n-%m.patch" |
| 114 |
</pre> |
| 115 |
</li> |
| 116 |
</ul> |
| 117 |
</div> |
| 118 |
<p>Returns 0 on success.</p> |
| 119 |
</div> |
| 120 |
<div class="section" id="options"> |
| 121 |
<h1><a class="toc-backref" href="#contents">Options</a></h1> |
| 122 |
<table class="docutils option-list" frame="void" rules="none"> |
| 123 |
<col class="option" /> |
| 124 |
<col class="description" /> |
| 125 |
<tbody valign="top"> |
| 126 |
<tr><td class="option-group" colspan="2"> |
| 127 |
<kbd><span class="option">-B</span>, <span class="option">--bookmark <var><BOOKMARK></var></span></kbd></td> |
| 128 |
</tr> |
| 129 |
<tr><td> </td><td>export changes only reachable by given bookmark</td></tr> |
| 130 |
<tr><td class="option-group" colspan="2"> |
| 131 |
<kbd><span class="option">-o</span>, <span class="option">--output <var><FORMAT></var></span></kbd></td> |
| 132 |
</tr> |
| 133 |
<tr><td> </td><td>print output to file with formatted name</td></tr> |
| 134 |
<tr><td class="option-group" colspan="2"> |
| 135 |
<kbd><span class="option">--switch-parent</span></kbd></td> |
| 136 |
</tr> |
| 137 |
<tr><td> </td><td>diff against the second parent</td></tr> |
| 138 |
<tr><td class="option-group" colspan="2"> |
| 139 |
<kbd><span class="option">-r</span>, <span class="option">--rev <var><REV[+]></var></span></kbd></td> |
| 140 |
</tr> |
| 141 |
<tr><td> </td><td>revisions to export</td></tr> |
| 142 |
<tr><td class="option-group"> |
| 143 |
<kbd><span class="option">-a</span>, <span class="option">--text</span></kbd></td> |
| 144 |
<td>treat all files as text</td></tr> |
| 145 |
<tr><td class="option-group"> |
| 146 |
<kbd><span class="option">-g</span>, <span class="option">--git</span></kbd></td> |
| 147 |
<td>use git extended diff format (DEFAULT: diff.git)</td></tr> |
| 148 |
<tr><td class="option-group"> |
| 149 |
<kbd><span class="option">--binary</span></kbd></td> |
| 150 |
<td>generate binary diffs in git mode (default)</td></tr> |
| 151 |
<tr><td class="option-group"> |
| 152 |
<kbd><span class="option">--nodates</span></kbd></td> |
| 153 |
<td>omit dates from diff headers</td></tr> |
| 154 |
<tr><td class="option-group" colspan="2"> |
| 155 |
<kbd><span class="option">-T</span>, <span class="option">--template <var><TEMPLATE></var></span></kbd></td> |
| 156 |
</tr> |
| 157 |
<tr><td> </td><td>display with template</td></tr> |
| 158 |
</tbody> |
| 159 |
</table> |
| 160 |
<p>[+] marked option can be specified multiple times</p> |
| 161 |
</div> |
| 162 |
</div> |
| 163 |
</body> |
| 164 |
</html> |