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