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