Mercurial > cpdt > repo
Help: import
hg import [OPTION]... PATCH...
aliases: patch
import an ordered set of patches
Import a list of patches and commit them individually (unless --no-commit is specified).
Because import first applies changes to the working directory, import will abort if there are outstanding changes.
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 commit message.
If the imported patch was generated by "hg export", 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.
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 may happen due to character set problems or other deficiencies in the text patch format.
Use --bypass to apply and commit patches directly to the repository, not touching the working directory. Without --exact, patches will be applied on top of the working directory parent revision.
With -s/--similarity, hg will attempt to discover renames and copies in the patch in the same way as "hg addremove".
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 <target-file>.rej file. Conflicts can then be resolved by hand before "hg commit --amend" 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, ...). Note that when none of the hunk applies cleanly, "hg import --partial" will create an empty changeset, importing only the patch metadata.
To read a patch from standard input, use "-" as the patch name. If a URL is specified, the patch will be downloaded from it. See "hg help dates" for a list of formats valid for -d/--date.
Examples:
- import a traditional patch from a website and detect renames:
hg import -s 80 http://example.com/bugfix.patch
- import a changeset from an hgweb server:
hg import http://www.selenic.com/hg/rev/5ca8c111e9aa
- import all the patches in an Unix-style mbox:
hg import incoming-patches.mbox
- attempt to exactly restore an exported changeset (not always possible):
hg import --exact proposed-fix.patch
Returns 0 on success, 1 on partial success (see --partial).
options:
-p | --strip NUM | directory strip option for patch. This has the same meaning as the corresponding patch option (default: 1) |
-b | --base PATH | base path (DEPRECATED) |
-e | --edit | invoke editor on commit messages |
-f | --force | skip check for outstanding uncommitted changes (DEPRECATED) |
--no-commit | don't commit, just update the working directory | |
--bypass | apply patch without touching the working directory | |
--partial | commit even if some hunks fail | |
--exact | apply patch to the nodes from which it was generated | |
--import-branch | use any branch information in patch (implied by --exact) | |
-m | --message TEXT | use text as commit message |
-l | --logfile FILE | read commit message from file |
-d | --date DATE | record the specified date as commit date |
-u | --user USER | record the specified user as committer |
-s | --similarity SIMILARITY | guess renamed files by similarity (0<=s<=100) |
global options:
-R | --repository REPO | repository root directory or name of overlay bundle file |
--cwd DIR | change working directory | |
-y | --noninteractive | do not prompt, automatically pick the first choice for all prompts |
-q | --quiet | suppress output |
-v | --verbose | enable additional output |
--config CONFIG [+] | set/override config option (use 'section.name=value') | |
--debug | enable debugging output | |
--debugger | start debugger | |
--encoding ENCODE | set the charset encoding (default: ascii) | |
--encodingmode MODE | set the charset encoding mode (default: strict) | |
--traceback | always print a traceback on exception | |
--time | time how long the command takes | |
--profile | print command execution profile | |
--version | output version information and exit | |
-h | --help | display help and exit |
--hidden | consider hidden changesets |
[+] marked option can be specified multiple times