fastimport Extension

This extension is not distributed with Mercurial.

Author: Paul Crowley
Author: Ian Clatworthy (parser code borrowed from Bazaar)
Author: Greg Ward (current maintainer)



Repository: (Updates to work with Mercurial 3.2+)

Repository: (Updates to work with Mercurial 5.6+ and Python 3.9+)


The "fast import" format originates with Git, where it is used as the generic backend for converting other SCM repositories to git. It's generic enough that it can be used to feed a Mercurial repository as well, and that's what this extension does: read a "fast import" stream and turn it into changesets in a Mercurial repository. The potential of this extension is that any foreign SCM that can be converted to Git can also be converted to Mercurial, regardless of the capabilities of Mercurial's own ConvertExtension. The catch is that the conversion is a little cumbersome: first convert to a fast-import dump, then feed that dump to Mercurial.



$ pip install --user hg-fastimport


Enable the extension by adding this line to [extensions] in ~/.hgrc:

fastimport =


Usage is simple:

hg fastimport FILE ...

reads a fast-import stream from each FILE and adds changesets to the current repository. For example, to create a brand-new repository from foo.git-dump:

hg init foo.hg
hg -R foo.hg fastimport foo.git-dump

Limitations and caveats

There are some commands in the fast-import language that are not supported by hg-fastimport. You'll know them when you see them; Mercurial will crash with an exception.


FastImportExtension (last edited 2021-02-15 12:38:24 by rsmarples)