hg-fast-export.py: include unnamed head's branch
[fast-export/rorcz.git] / README.md
blob442b1b4eda245ec92ef5fdc5b706810cef9db4a6
1 hg-fast-export.(sh|py) - mercurial to git converter using git-fast-import
2 =========================================================================
4 Legal
5 -----
7 Most hg-* scripts are licensed under the [MIT license]
8 (http://www.opensource.org/licenses/mit-license.php) and were written
9 by Rocco Rutte <pdmef@gmx.net> with hints and help from the git list and
10 \#mercurial on freenode. hg-reset.py is licensed under GPLv2 since it
11 copies some code from the mercurial sources.
13 The current maintainer is Frej Drejhammar <frej.drejhammar@gmail.com>.
15 Usage
16 -----
18 Using hg-fast-export is quite simple for a mercurial repository <repo>:
20 ```
21 mkdir repo-git # or whatever
22 cd repo-git
23 git init
24 hg-fast-export.sh -r <repo>
25 ```
27 Please note that hg-fast-export does not automatically check out the
28 newly imported repository. You probably want to follow up the import
29 with a `git checkout`-command.
31 Incremental imports to track hg repos is supported, too.
33 Using hg-reset it is quite simple within a git repository that is
34 hg-fast-export'ed from mercurial:
36 ```
37 hg-reset.sh -R <revision>
38 ```
40 will give hints on which branches need adjustment for starting over
41 again.
43 As mercurial appears to be much less picky about the syntax of the
44 author information than git, an author mapping file can be given to
45 hg-fast-export to fix up malformed author strings. The file is
46 specified using the -A option. The file should contain lines of the
47 form `FromAuthor=ToAuthor`. The example authors.map below will
48 translate `User <garbage<user@example.com>` to `User <user@example.com>`.
50 ```
51 -- Start of authors.map --
52 User <garbage<user@example.com>=User <user@example.com>
53 -- End of authors.map --
54 ```
56 Notes/Limitations
57 -----------------
59 hg-fast-export supports multiple branches but only named branches with
60 exactly one head each. Otherwise commits to the tip of these heads
61 within the branch will get flattened into merge commits.
63 As each git-fast-import run creates a new pack file, it may be
64 required to repack the repository quite often for incremental imports
65 (especially when importing a small number of changesets per
66 incremental import).
68 The way the hg API and remote access protocol is designed it is not
69 possible to use hg-fast-export on remote repositories
70 (http/ssh). First clone the repository, then convert it.
72 Design
73 ------
75 hg-fast-export.py was designed in a way that doesn't require a 2-pass
76 mechanism or any prior repository analysis: if just feeds what it
77 finds into git-fast-import. This also implies that it heavily relies
78 on strictly linear ordering of changesets from hg, i.e. its
79 append-only storage model so that changesets hg-fast-export already
80 saw never get modified.
82 Submitting Patches
83 ------------------
85 Please use the issue-tracker at github
86 https://github.com/frej/fast-export to report bugs and submit
87 patches.