Update usage section example commands
[fast-export.git] / README.md
blobf335670def3a5e6adb42451d18c7ecac377a5b91
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 Support
16 -------
18 If you have problems with hg-fast-export or have found a bug, please
19 create an issue at the [github issue tracker]
20 (https://github.com/frej/fast-export/issues). Before creating a new
21 issue, check that your problem has not already been addressed in an
22 already closed issue. Do not contact the maintainer directly unless
23 you want to report a security bug. That way the next person having the
24 same problem can benefit from the time spent solving the problem the
25 first time.
27 Usage
28 -----
30 Using hg-fast-export is quite simple for a mercurial repository <repo>:
32 ```
33 mkdir repo-git # or whatever
34 cd repo-git
35 git init
36 hg-fast-export.sh -r <local-repo>
37 git checkout HEAD
38 ```
40 Please note that hg-fast-export does not automatically check out the
41 newly imported repository. You probably want to follow up the import
42 with a `git checkout`-command.
44 Incremental imports to track hg repos is supported, too.
46 Using hg-reset it is quite simple within a git repository that is
47 hg-fast-export'ed from mercurial:
49 ```
50 hg-reset.sh -R <revision>
51 ```
53 will give hints on which branches need adjustment for starting over
54 again.
56 When a mercurial repository does not use utf-8 for encoding author
57 strings and commit messages the `-e <encoding>` command line option
58 can be used to force fast-export to convert incoming meta data from
59 <encoding> to utf-8. This encoding option is also applied to file names.
61 In some locales Mercurial uses different encodings for commit messages
62 and file names. In that case, you can use `--fe <encoding>` command line
63 option which overrides the -e option for file names.
65 As mercurial appears to be much less picky about the syntax of the
66 author information than git, an author mapping file can be given to
67 hg-fast-export to fix up malformed author strings. The file is
68 specified using the -A option. The file should contain lines of the
69 form `"<key>"="<value>"`. Inside the key and value strings, all escape
70 sequences understood by the python `string_escape` encoding are
71 supported. (Versions of fast-export prior to v171002 had a different
72 syntax, the old syntax can be enabled by the flag
73 `--mappings-are-raw`.)
75 The example authors.map below will translate `User
76 <garbage<tab><user@example.com>` to `User <user@example.com>`.
78 ```
79 -- Start of authors.map --
80 "User <garbage\t<user@example.com>"="User <user@example.com>"
81 -- End of authors.map --
82 ```
84 Tag and Branch Naming
85 ---------------------
87 As Git and Mercurial have differ in what is a valid branch and tag
88 name the -B and -T options allow a mapping file to be specified to
89 rename branches and tags (respectively). The syntax of the mapping
90 file is the same as for the author mapping.
92 Notes/Limitations
93 -----------------
95 hg-fast-export supports multiple branches but only named branches with
96 exactly one head each. Otherwise commits to the tip of these heads
97 within the branch will get flattened into merge commits.
99 As each git-fast-import run creates a new pack file, it may be
100 required to repack the repository quite often for incremental imports
101 (especially when importing a small number of changesets per
102 incremental import).
104 The way the hg API and remote access protocol is designed it is not
105 possible to use hg-fast-export on remote repositories
106 (http/ssh). First clone the repository, then convert it.
108 Design
109 ------
111 hg-fast-export.py was designed in a way that doesn't require a 2-pass
112 mechanism or any prior repository analysis: if just feeds what it
113 finds into git-fast-import. This also implies that it heavily relies
114 on strictly linear ordering of changesets from hg, i.e. its
115 append-only storage model so that changesets hg-fast-export already
116 saw never get modified.
118 Submitting Patches
119 ------------------
121 Please use the issue-tracker at github
122 https://github.com/frej/fast-export to report bugs and submit
123 patches.