Skip to main content

Exports/synchronizes a Mercurial repo to Git

Project description

https://img.shields.io/travis/nicktimko/autolycus.svg?maxAge=2592000?style=flat-square:target:https://travis-ci.org/nicktimko/autolycus https://img.shields.io/codecov/c/github/nicktimko/autolycus.svg?maxAge=2592000?style=flat-square:target:https://codecov.io/gh/nicktimko/autolycus https://img.shields.io/pypi/v/autolycus.svg?maxAge=2592000?style=flat-square:target:https://pypi.python.org/pypi/autolycus

Usage

Using hg-fast-export is quite simple for a Mercurial repository :

mkdir repo-git # or whatever
cd repo-git
git init
hg-fast-export.sh -r <repo>

Please note that hg-fast-export does not automatically check out the newly imported repository. You probably want to follow up the import with a git checkout-command.

Incremental imports to track hg repos is supported, too.

Using hg-reset it is quite simple within a Git repository that is hg-fast-export‘ed from Mercurial:

hg-reset.sh -R <revision>

will give hints on which branches need adjustment for starting over again.

When a Mercurial repository does not use UTF-8 for encoding author strings and commit messages the -e <encoding> command line option can be used to force fast-export to convert incoming meta data from to UTF-8. This encoding option is also applied to file names.

In some locales Mercurial uses different encodings for commit messages and file names. In that case, you can use --fe <encoding> command line option which overrides the -e option for file names.

As Mercurial appears to be much less picky about the syntax of the author information than Git, an author mapping file can be given to hg-fast-export to fix up malformed author strings. The file is specified using the -A option. The file should contain lines of the form FromAuthor=ToAuthor. The example authors.map below will translate User <garbage<user@example.com> to User <user@example.com>.

-- Start of authors.map --
User <garbage<user@example.com>=User <user@example.com>
-- End of authors.map --

Tag and Branch Naming

As Git and Mercurial have differ in what is a valid branch and tag name the -B and -T options allow a mapping file to be specified to rename branches and tags (respectively). The syntax of the mapping file is the same as for the author mapping.

Notes/Limitations

hg-fast-export supports multiple branches but only named branches with exactly one head each. Otherwise commits to the tip of these heads within the branch will get flattened into merge commits.

As each git-fast-import run creates a new pack file, it may be required to repack the repository quite often for incremental imports (especially when importing a small number of changesets per incremental import).

The way the Hg API and remote access protocol is designed it is not possible to use hg-fast-export on remote repositories (HTTP/SSH). First clone the repository, then convert it.

Mercurial doesn’t support Python 3 and probably won’t for a while.

Design

hg-fast-export.py was designed in a way that doesn’t require a 2-pass mechanism or any prior repository analysis: if just feeds what it finds into git-fast-import. This also implies that it heavily relies on strictly linear ordering of changesets from Hg, i.e. its append-only storage model so that changesets hg-fast-export already saw never get modified.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autolycus-0.0.7.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

autolycus-0.0.7-py2-none-any.whl (22.1 kB view details)

Uploaded Python 2

File details

Details for the file autolycus-0.0.7.tar.gz.

File metadata

  • Download URL: autolycus-0.0.7.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for autolycus-0.0.7.tar.gz
Algorithm Hash digest
SHA256 45cbac9e8c72debcee9112cd4f94651dfe6e97b968d717d4b7a452d7a66d5e45
MD5 0e6ea6bc81d5e757ac3a13107ed67301
BLAKE2b-256 cdeb2413a52794374a0eeff50b829c2f015f17196a9a97ca1f6939c52a8e8943

See more details on using hashes here.

File details

Details for the file autolycus-0.0.7-py2-none-any.whl.

File metadata

File hashes

Hashes for autolycus-0.0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 aca6b92c04d68d331abde92a04c34f5d6ef8926ed32f84386ceee2892f9fa4a6
MD5 08c935e744030d8c77174aedb317595e
BLAKE2b-256 3b4f7f2bf3a80b9cf0ca3206e29c740968e81215f3b40f39690a193d70adeaa2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page