File: hg-import.html

package info (click to toggle)
mercurial 7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 45,084 kB
  • sloc: python: 208,593; ansic: 56,460; tcl: 3,715; sh: 1,839; lisp: 1,483; cpp: 864; makefile: 769; javascript: 649; xml: 36
file content (198 lines) | stat: -rw-r--r-- 9,654 bytes parent folder | download | duplicates (3)
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?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 import</title>
<link rel="stylesheet" href="../style.css" type="text/css" />
</head>
<body>
<div class="document" id="hg-import">
<span id="hg-import-1"></span>
<h1 class="title">hg import</h1>
<h2 class="subtitle" id="import-an-ordered-set-of-patches">import an ordered set of patches</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>
<li><a class="reference internal" href="#aliases" id="toc-entry-4">Aliases</a></li>
</ul>
</div>
<div class="section" id="synopsis">
<h1><a class="toc-backref" href="#contents">Synopsis</a></h1>
<pre class="literal-block">
hg import [OPTION]... PATCH...
</pre>
</div>
<div class="section" id="description">
<h1><a class="toc-backref" href="#contents">Description</a></h1>
<p>Import a list of patches and commit them individually (unless
--no-commit is specified).</p>
<p>To read a patch from standard input (stdin), use &quot;-&quot; as the patch
name. If a URL is specified, the patch will be downloaded from
there.</p>
<p>Import first applies changes to the working directory (unless
--bypass is specified), import will abort if there are outstanding
changes.</p>
<p>Use --bypass to apply and commit patches directly to the
repository, without affecting the working directory. Without
--exact, patches will be applied on top of the working directory
parent revision.</p>
<p>You can import a patch straight from a mail message. Even patches
as attachments work (to use the body part, it must have type
text/plain or text/x-patch). From and Subject headers of email
message are used as default committer and commit message. All
text/plain body parts before first diff are added to the commit
message.</p>
<p>If the imported patch was generated by <a class="reference external" href="hg-export.html"><tt class="docutils literal">hg export</tt></a>, user and
description from patch override values from message headers and
body. Values given on command line with -m/--message and -u/--user
override these.</p>
<p>If --exact is specified, import will set the working directory to
the parent of each patch before applying it, and will abort if the
resulting changeset has a different ID than the one recorded in
the patch. This will guard against various ways that portable
patch formats and mail systems might fail to transfer Mercurial
data or metadata. See <a class="reference external" href="hg-bundle.html"><tt class="docutils literal">hg bundle</tt></a> for lossless transmission.</p>
<p>Use --partial to ensure a changeset will be created from the patch
even if some hunks fail to apply. Hunks that fail to apply will be
written to a &lt;target-file&gt;.rej file. Conflicts can then be resolved
by hand before <a class="reference external" href="hg-commit.html"><tt class="docutils literal">hg commit <span class="pre">--amend</span></tt></a> is run to update the created
changeset. This flag exists to let people import patches that
partially apply without losing the associated metadata (author,
date, description, ...).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">When no hunks apply cleanly, <a class="reference external" href="hg-import.html"><tt class="docutils literal">hg import <span class="pre">--partial</span></tt></a> will create
an empty changeset, importing only the patch metadata.</p>
</div>
<p>With -s/--similarity, hg will attempt to discover renames and
copies in the patch in the same way as <a class="reference external" href="hg-addremove.html"><tt class="docutils literal">hg addremove</tt></a>.</p>
<p>It is possible to use external patch programs to perform the patch
by setting the <tt class="docutils literal">ui.patch</tt> configuration option. For the default
internal tool, the fuzz can also be configured via <tt class="docutils literal">patch.fuzz</tt>.
See <a class="reference external" href="hgrc.5.html"><tt class="docutils literal">hg help config</tt></a> for more information about configuration
files and how to use these options.</p>
<p>See <a class="reference external" href="topic-dates.html"><tt class="docutils literal">hg help dates</tt></a> for a list of formats valid for -d/--date.</p>
<div class="verbose docutils container">
<p>Examples:</p>
<ul>
<li><p class="first">import a traditional patch from a website and detect renames:</p>
<pre class="literal-block">
hg import -s 80 http://example.com/bugfix.patch
</pre>
</li>
<li><p class="first">import a changeset from an hgweb server:</p>
<pre class="literal-block">
hg import https://www.mercurial-scm.org/repo/hg/rev/5ca8c111e9aa
</pre>
</li>
<li><p class="first">import all the patches in an Unix-style mbox:</p>
<pre class="literal-block">
hg import incoming-patches.mbox
</pre>
</li>
<li><p class="first">import patches from stdin:</p>
<pre class="literal-block">
hg import -
</pre>
</li>
<li><p class="first">attempt to exactly restore an exported changeset (not always
possible):</p>
<pre class="literal-block">
hg import --exact proposed-fix.patch
</pre>
</li>
<li><p class="first">use an external tool to apply a patch which is too fuzzy for
the default internal tool.</p>
<blockquote>
<p>hg import --config ui.patch=&quot;patch --merge&quot; fuzzy.patch</p>
</blockquote>
</li>
<li><p class="first">change the default fuzzing from 2 to a less strict 7</p>
<blockquote>
<p>hg import --config ui.fuzz=7 fuzz.patch</p>
</blockquote>
</li>
</ul>
</div>
<p>Returns 0 on success, 1 on partial success (see --partial).</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">-p</span>, <span class="option">--strip <var>&lt;NUM&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>directory strip option for patch. This has the same meaning as the corresponding patch option (default: 1)</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-b</span>, <span class="option">--base <var>&lt;PATH&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>base path (DEPRECATED)</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--secret</span></kbd></td>
<td>use the secret phase for committing</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-e</span>, <span class="option">--edit</span></kbd></td>
<td>invoke editor on commit messages</td></tr>
<tr><td class="option-group">
<kbd><span class="option">-f</span>, <span class="option">--force</span></kbd></td>
<td>skip check for outstanding uncommitted changes (DEPRECATED)</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--no-commit</span></kbd></td>
<td>don't commit, just update the working directory</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--bypass</span></kbd></td>
<td>apply patch without touching the working directory</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--partial</span></kbd></td>
<td>commit even if some hunks fail</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--exact</span></kbd></td>
<td>abort if patch would apply lossily</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--prefix <var>&lt;DIR&gt;</var></span></kbd></td>
<td>apply patch to subdirectory</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--import-branch</span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>use any branch information in patch (implied by --exact)</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-m</span>, <span class="option">--message <var>&lt;TEXT&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>use text as commit message</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-l</span>, <span class="option">--logfile <var>&lt;FILE&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>read commit message from file</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-d</span>, <span class="option">--date <var>&lt;DATE&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>record the specified date as commit date</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-u</span>, <span class="option">--user <var>&lt;USER&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>record the specified user as committer</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">-s</span>, <span class="option">--similarity <var>&lt;SIMILARITY&gt;</var></span></kbd></td>
</tr>
<tr><td>&nbsp;</td><td>guess renamed files by similarity (0&lt;=s&lt;=100)</td></tr>
</tbody>
</table>
</div>
<div class="section" id="aliases">
<h1><a class="toc-backref" href="#contents">Aliases</a></h1>
<pre class="literal-block">
patch
</pre>
</div>
</div>
</body>
</html>