Files
Fast-Export/hg-fast-export.txt

72 lines
2.0 KiB
Plaintext
Raw Normal View History

hg-fast-import.(sh|py) - mercurial to git converter using git-fast-import
Legal
=====
Most hg-* scripts are licensed under the MIT license[0] 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.
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-import.sh -r <repo>
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.
Notes/Limitations
=================
hg-fast-import supports multiple branches but only named branches with exaclty
one head each. Otherwise commits to the tip of these heads within 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).
Design
======
hg-fast-import.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-import already saw never get modified.
Todo
====
For incremental imports, handling tags needs to be reworked (maybe):
Right now we assume that once a tag is created, it stays forever and
never changes. However,
1) tags in hg may be removed
2) tags may change
I'm not yet sure how to handle this and how this interferes with
non-hg-based tags in git.
The same for branches: They may get removed.
For one-time conversions, everything is fine.
Footnotes
=========
[0] http://www.opensource.org/licenses/mit-license.php