4 # repository formats. |
4 # repository formats. |
5 # |
5 # |
6 # In its current form, it's hardcoded to convert incrementally between |
6 # In its current form, it's hardcoded to convert incrementally between |
7 # git and Mercurial. |
7 # git and Mercurial. |
8 # |
8 # |
9 # To use, you must first import the first git version into Mercurial, |
9 # To use, run: |
10 # and establish a mapping between the git commit hash and the hash in |
10 # |
11 # Mercurial for that version. This mapping is kept in a simple text |
11 # convert-repo <git-dir> <hg-dir> <mapfile> |
12 # file with lines like so: |
12 # |
|
13 # (don't forget to create the <hg-dir> repository beforehand) |
|
14 # |
|
15 # The <mapfile> is a simple text file that maps a git commit hash to |
|
16 # the hash in Mercurial for that version, like so: |
13 # |
17 # |
14 # <git hash> <mercurial hash> |
18 # <git hash> <mercurial hash> |
15 # |
19 # |
16 # To convert the rest of the repo, run: |
20 # If the file doesn't exist, it's automatically created. It's updated |
17 # |
21 # on each commit copied, so convert-repo can be interrupted and can |
18 # convert-repo <git-dir> <hg-dir> <mapfile> |
22 # be run repeatedly to copy new commits. |
19 # |
|
20 # This updates the mapfile on each commit copied, so it can be |
|
21 # interrupted and can be run repeatedly to copy new commits. |
|
22 |
23 |
23 import sys, os, zlib, sha, time |
24 import sys, os, zlib, sha, time |
24 |
25 |
25 os.environ["HGENCODING"] = "utf-8" |
26 os.environ["HGENCODING"] = "utf-8" |
26 |
27 |