descriptionThe repo.or.cz "Girocco" hg fast-export tool
homepage URLhttps://repo.or.cz/
owneradmin@repo.or.cz
last changeMon, 14 Nov 2016 15:16:47 +0000 (14 07:16 -0800)
content tags
add:
README.md

hg-fast-export.(sh|py) - mercurial to git converter using git-fast-import

Most hg-* scripts are licensed under the [MIT license] (http://www.opensource.org/licenses/mit-license.php) and were written by Rocco Rutte <pdmef@gmx.net> with hints and help from the git list and #mercurial on freenode. hg-reset.py is licensed under GPLv2 since it copies some code from the mercurial sources.

The current maintainer is Frej Drejhammar <frej.drejhammar@gmail.com>.

Usage

Using hg-fast-export is quite simple for a mercurial repository <repo>:

mkdir repo-git # or whatever
cd repo-git
git init
hg-fast-export.sh -r <repo>

Please note that hg-fast-export does not automatically check out the newly imported repository. You probably want to follow up the import with a git checkout-command.

Incremental imports to track hg repos is supported, too.

Using hg-reset it is quite simple within a git repository that is hg-fast-export'ed from mercurial:

hg-reset.sh -R <revision>

will give hints on which branches need adjustment for starting over again.

As mercurial appears to be much less picky about the syntax of the author information than git, an author mapping file can be given to hg-fast-export to fix up malformed author strings. The file is specified using the -A option. The file should contain lines of the form FromAuthor=ToAuthor. The example authors.map below will translate User <garbage<user@example.com> to User <user@example.com>.

-- Start of authors.map --
User <garbage<user@example.com>=User <user@example.com>
-- End of authors.map --

Notes/Limitations

hg-fast-export supports multiple branches but only named branches with exactly one head each. Otherwise commits to the tip of these heads within the branch will get flattened into merge commits.

As each git-fast-import run creates a new pack file, it may be required to repack the repository quite often for incremental imports (especially when importing a small number of changesets per incremental import).

The way the hg API and remote access protocol is designed it is not possible to use hg-fast-export on remote repositories (http/ssh). First clone the repository, then convert it.

Design

hg-fast-export.py was designed in a way that doesn't require a 2-pass mechanism or any prior repository analysis: if just feeds what it finds into git-fast-import. This also implies that it heavily relies on strictly linear ordering of changesets from hg, i.e. its append-only storage model so that changesets hg-fast-export already saw never get modified.

Submitting Patches

Please use the issue-tracker at github https://github.com/frej/fast-export to report bugs and submit patches.

shortlog
2016-11-14 Kyle J. McKayhg-{fast-export,reset}.sh: add git --exec-path to PATHgirocco
2016-07-10 Kyle J. McKayhg-fast-export.sh: prune notes on missing marks
2016-07-10 Kyle J. McKayhg-fast-export.sh: handle gc'd marks
2016-07-10 Kyle J. McKayhg-fast-export.py: include unnamed head's branch
2016-07-04 Kyle J. McKayhg-fast-export.sh: let git manage the marks
2016-07-04 Kyle J. McKayhg-fast-export.sh: replace awkward git-branch usage...
2016-07-04 Kyle J. McKayhg-fast-export: get rid of ridiculous 'devnull@localhos...
2016-06-29 Kyle J. McKayhg-fast-export.py: do not mangle UTF-8 characters
2016-06-29 Kyle J. McKayhg2git.py: do not require python 2.7
2016-06-26 Kyle J. McKayhg-fast-export.py: don't step on previous --hg-hash...
2016-06-26 Frej DrejhammarSwitch from os.popen() to subprocess.check_output(...
2016-06-26 Frej DrejhammarRemove obsolete and unsupported SVN tools
2016-06-26 Mark RaymondUse backquotes
2016-06-26 Mark RaymondUse GitHub markdown
2016-06-26 Mark RaymondRename README to README.md
2016-06-26 Frej DrejhammarSurvive corrupt source repositories
...
heads
7 years ago girocco