chris@1544: hg-fast-export.(sh|py) - mercurial to git converter using git-fast-import chris@1544: ========================================================================= chris@1544: chris@1544: Legal chris@1544: ----- chris@1544: chris@1544: Most hg-* scripts are licensed under the [MIT license] chris@1544: (http://www.opensource.org/licenses/mit-license.php) and were written chris@1544: by Rocco Rutte with hints and help from the git list and chris@1544: \#mercurial on freenode. hg-reset.py is licensed under GPLv2 since it chris@1544: copies some code from the mercurial sources. chris@1544: chris@1544: The current maintainer is Frej Drejhammar . chris@1544: chris@1544: Usage chris@1544: ----- chris@1544: chris@1544: Using hg-fast-export is quite simple for a mercurial repository : chris@1544: chris@1544: ``` chris@1544: mkdir repo-git # or whatever chris@1544: cd repo-git chris@1544: git init chris@1544: hg-fast-export.sh -r chris@1544: ``` chris@1544: chris@1544: Please note that hg-fast-export does not automatically check out the chris@1544: newly imported repository. You probably want to follow up the import chris@1544: with a `git checkout`-command. chris@1544: chris@1544: Incremental imports to track hg repos is supported, too. chris@1544: chris@1544: Using hg-reset it is quite simple within a git repository that is chris@1544: hg-fast-export'ed from mercurial: chris@1544: chris@1544: ``` chris@1544: hg-reset.sh -R chris@1544: ``` chris@1544: chris@1544: will give hints on which branches need adjustment for starting over chris@1544: again. chris@1544: chris@1544: When a mercurial repository does not use utf-8 for encoding author chris@1544: strings and commit messages the `-e ` command line option chris@1544: can be used to force fast-export to convert incoming meta data from chris@1544: to utf-8. This encoding option is also applied to file names. chris@1544: chris@1544: In some locales Mercurial uses different encodings for commit messages chris@1544: and file names. In that case, you can use `--fe ` command line chris@1544: option which overrides the -e option for file names. chris@1544: chris@1544: As mercurial appears to be much less picky about the syntax of the chris@1544: author information than git, an author mapping file can be given to chris@1544: hg-fast-export to fix up malformed author strings. The file is chris@1544: specified using the -A option. The file should contain lines of the chris@1544: form `FromAuthor=ToAuthor`. The example authors.map below will chris@1544: translate `User ` to `User `. chris@1544: chris@1544: ``` chris@1544: -- Start of authors.map -- chris@1544: User =User chris@1544: -- End of authors.map -- chris@1544: ``` chris@1544: chris@1544: Tag and Branch Naming chris@1544: --------------------- chris@1544: chris@1544: As Git and Mercurial have differ in what is a valid branch and tag chris@1544: name the -B and -T options allow a mapping file to be specified to chris@1544: rename branches and tags (respectively). The syntax of the mapping chris@1544: file is the same as for the author mapping. chris@1544: chris@1544: Notes/Limitations chris@1544: ----------------- chris@1544: chris@1544: hg-fast-export supports multiple branches but only named branches with chris@1544: exactly one head each. Otherwise commits to the tip of these heads chris@1544: within the branch will get flattened into merge commits. chris@1544: chris@1544: As each git-fast-import run creates a new pack file, it may be chris@1544: required to repack the repository quite often for incremental imports chris@1544: (especially when importing a small number of changesets per chris@1544: incremental import). chris@1544: chris@1544: The way the hg API and remote access protocol is designed it is not chris@1544: possible to use hg-fast-export on remote repositories chris@1544: (http/ssh). First clone the repository, then convert it. chris@1544: chris@1544: Design chris@1544: ------ chris@1544: chris@1544: hg-fast-export.py was designed in a way that doesn't require a 2-pass chris@1544: mechanism or any prior repository analysis: if just feeds what it chris@1544: finds into git-fast-import. This also implies that it heavily relies chris@1544: on strictly linear ordering of changesets from hg, i.e. its chris@1544: append-only storage model so that changesets hg-fast-export already chris@1544: saw never get modified. chris@1544: chris@1544: Submitting Patches chris@1544: ------------------ chris@1544: chris@1544: Please use the issue-tracker at github chris@1544: https://github.com/frej/fast-export to report bugs and submit chris@1544: patches.