| 1 |
.TH HG IMPORT "" "" "" |
| 2 |
.SH NAME |
| 3 |
hg import \- import an ordered set of patches |
| 4 |
.\" Man page generated from reStructuredText. |
| 5 |
. |
| 6 |
.SH SYNOPSIS |
| 7 |
.sp |
| 8 |
.nf |
| 9 |
.ft C |
| 10 |
hg import [OPTION]... PATCH... |
| 11 |
.ft P |
| 12 |
.fi |
| 13 |
.SH DESCRIPTION |
| 14 |
.sp |
| 15 |
Import a list of patches and commit them individually (unless |
| 16 |
\-\-no\-commit is specified). |
| 17 |
.sp |
| 18 |
To read a patch from standard input (stdin), use "\-" as the patch |
| 19 |
name. If a URL is specified, the patch will be downloaded from |
| 20 |
there. |
| 21 |
.sp |
| 22 |
Import first applies changes to the working directory (unless |
| 23 |
\-\-bypass is specified), import will abort if there are outstanding |
| 24 |
changes. |
| 25 |
.sp |
| 26 |
Use \-\-bypass to apply and commit patches directly to the |
| 27 |
repository, without affecting the working directory. Without |
| 28 |
\-\-exact, patches will be applied on top of the working directory |
| 29 |
parent revision. |
| 30 |
.sp |
| 31 |
You can import a patch straight from a mail message. Even patches |
| 32 |
as attachments work (to use the body part, it must have type |
| 33 |
text/plain or text/x\-patch). From and Subject headers of email |
| 34 |
message are used as default committer and commit message. All |
| 35 |
text/plain body parts before first diff are added to the commit |
| 36 |
message. |
| 37 |
.sp |
| 38 |
If the imported patch was generated by \%\fBhg export\fP\:, user and |
| 39 |
description from patch override values from message headers and |
| 40 |
body. Values given on command line with \-m/\-\-message and \-u/\-\-user |
| 41 |
override these. |
| 42 |
.sp |
| 43 |
If \-\-exact is specified, import will set the working directory to |
| 44 |
the parent of each patch before applying it, and will abort if the |
| 45 |
resulting changeset has a different ID than the one recorded in |
| 46 |
the patch. This will guard against various ways that portable |
| 47 |
patch formats and mail systems might fail to transfer Mercurial |
| 48 |
data or metadata. See \%\fBhg bundle\fP\: for lossless transmission. |
| 49 |
.sp |
| 50 |
Use \-\-partial to ensure a changeset will be created from the patch |
| 51 |
even if some hunks fail to apply. Hunks that fail to apply will be |
| 52 |
written to a <target\-file>.rej file. Conflicts can then be resolved |
| 53 |
by hand before \%\fBhg commit \-\-amend\fP\: is run to update the created |
| 54 |
changeset. This flag exists to let people import patches that |
| 55 |
partially apply without losing the associated metadata (author, |
| 56 |
date, description, ...). |
| 57 |
.IP Note |
| 58 |
. |
| 59 |
When no hunks apply cleanly, \%\fBhg import \-\-partial\fP\: will create |
| 60 |
an empty changeset, importing only the patch metadata. |
| 61 |
.RE |
| 62 |
.sp |
| 63 |
With \-s/\-\-similarity, hg will attempt to discover renames and |
| 64 |
copies in the patch in the same way as \%\fBhg addremove\fP\:. |
| 65 |
.sp |
| 66 |
It is possible to use external patch programs to perform the patch |
| 67 |
by setting the \fBui.patch\fP configuration option. For the default |
| 68 |
internal tool, the fuzz can also be configured via \fBpatch.fuzz\fP. |
| 69 |
See \%\fBhg help config\fP\: for more information about configuration |
| 70 |
files and how to use these options. |
| 71 |
.sp |
| 72 |
See \%\fBhg help dates\fP\: for a list of formats valid for \-d/\-\-date. |
| 73 |
.sp |
| 74 |
Examples: |
| 75 |
.INDENT 0.0 |
| 76 |
.IP \(bu 2 |
| 77 |
. |
| 78 |
import a traditional patch from a website and detect renames: |
| 79 |
.sp |
| 80 |
.nf |
| 81 |
.ft C |
| 82 |
hg import \-s 80 http://example.com/bugfix.patch |
| 83 |
.ft P |
| 84 |
.fi |
| 85 |
.IP \(bu 2 |
| 86 |
. |
| 87 |
import a changeset from an hgweb server: |
| 88 |
.sp |
| 89 |
.nf |
| 90 |
.ft C |
| 91 |
hg import https://www.mercurial\-scm.org/repo/hg/rev/5ca8c111e9aa |
| 92 |
.ft P |
| 93 |
.fi |
| 94 |
.IP \(bu 2 |
| 95 |
. |
| 96 |
import all the patches in an Unix\-style mbox: |
| 97 |
.sp |
| 98 |
.nf |
| 99 |
.ft C |
| 100 |
hg import incoming\-patches.mbox |
| 101 |
.ft P |
| 102 |
.fi |
| 103 |
.IP \(bu 2 |
| 104 |
. |
| 105 |
import patches from stdin: |
| 106 |
.sp |
| 107 |
.nf |
| 108 |
.ft C |
| 109 |
hg import \- |
| 110 |
.ft P |
| 111 |
.fi |
| 112 |
.IP \(bu 2 |
| 113 |
. |
| 114 |
attempt to exactly restore an exported changeset (not always |
| 115 |
possible): |
| 116 |
.sp |
| 117 |
.nf |
| 118 |
.ft C |
| 119 |
hg import \-\-exact proposed\-fix.patch |
| 120 |
.ft P |
| 121 |
.fi |
| 122 |
.IP \(bu 2 |
| 123 |
. |
| 124 |
use an external tool to apply a patch which is too fuzzy for |
| 125 |
the default internal tool. |
| 126 |
.INDENT 2.0 |
| 127 |
.INDENT 3.5 |
| 128 |
.sp |
| 129 |
hg import \-\-config ui.patch="patch \-\-merge" fuzzy.patch |
| 130 |
.UNINDENT |
| 131 |
.UNINDENT |
| 132 |
.IP \(bu 2 |
| 133 |
. |
| 134 |
change the default fuzzing from 2 to a less strict 7 |
| 135 |
.INDENT 2.0 |
| 136 |
.INDENT 3.5 |
| 137 |
.sp |
| 138 |
hg import \-\-config ui.fuzz=7 fuzz.patch |
| 139 |
.UNINDENT |
| 140 |
.UNINDENT |
| 141 |
.UNINDENT |
| 142 |
.sp |
| 143 |
Returns 0 on success, 1 on partial success (see \-\-partial). |
| 144 |
.SH OPTIONS |
| 145 |
.INDENT 0.0 |
| 146 |
.TP |
| 147 |
.BI \-p, \-\-strip \ <NUM> |
| 148 |
. |
| 149 |
directory strip option for patch. This has the same meaning as the corresponding patch option (default: 1) |
| 150 |
.TP |
| 151 |
.BI \-b, \-\-base \ <PATH> |
| 152 |
. |
| 153 |
base path (DEPRECATED) |
| 154 |
.TP |
| 155 |
.B \-\-secret |
| 156 |
. |
| 157 |
use the secret phase for committing |
| 158 |
.TP |
| 159 |
.B \-e, \-\-edit |
| 160 |
. |
| 161 |
invoke editor on commit messages |
| 162 |
.TP |
| 163 |
.B \-f, \-\-force |
| 164 |
. |
| 165 |
skip check for outstanding uncommitted changes (DEPRECATED) |
| 166 |
.TP |
| 167 |
.B \-\-no\-commit |
| 168 |
. |
| 169 |
don\(aqt commit, just update the working directory |
| 170 |
.TP |
| 171 |
.B \-\-bypass |
| 172 |
. |
| 173 |
apply patch without touching the working directory |
| 174 |
.TP |
| 175 |
.B \-\-partial |
| 176 |
. |
| 177 |
commit even if some hunks fail |
| 178 |
.TP |
| 179 |
.B \-\-exact |
| 180 |
. |
| 181 |
abort if patch would apply lossily |
| 182 |
.TP |
| 183 |
.BI \-\-prefix \ <DIR> |
| 184 |
. |
| 185 |
apply patch to subdirectory |
| 186 |
.TP |
| 187 |
.B \-\-import\-branch |
| 188 |
. |
| 189 |
use any branch information in patch (implied by \-\-exact) |
| 190 |
.TP |
| 191 |
.BI \-m, \-\-message \ <TEXT> |
| 192 |
. |
| 193 |
use text as commit message |
| 194 |
.TP |
| 195 |
.BI \-l, \-\-logfile \ <FILE> |
| 196 |
. |
| 197 |
read commit message from file |
| 198 |
.TP |
| 199 |
.BI \-d, \-\-date \ <DATE> |
| 200 |
. |
| 201 |
record the specified date as commit date |
| 202 |
.TP |
| 203 |
.BI \-u, \-\-user \ <USER> |
| 204 |
. |
| 205 |
record the specified user as committer |
| 206 |
.TP |
| 207 |
.BI \-s, \-\-similarity \ <SIMILARITY> |
| 208 |
. |
| 209 |
guess renamed files by similarity (0<=s<=100) |
| 210 |
.UNINDENT |
| 211 |
.SH ALIASES |
| 212 |
.sp |
| 213 |
.nf |
| 214 |
.ft C |
| 215 |
patch |
| 216 |
.ft P |
| 217 |
.fi |
| 218 |
.\" Generated by docutils manpage writer. |
| 219 |
.\" |
| 220 |
. |