Differences between revisions 1 and 7 (spanning 6 versions)
Revision 1 as of 2009-04-01 01:43:45
Size: 2339
Editor: GregWard
Comment: new page (extension under new management)
Revision 7 as of 2011-04-02 00:46:20
Size: 3266
Editor: GregWard
Comment: standard link terminology
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
''Author: Paul Crowley''[[BR]]
''Author: Ian Clatworthy'' (parser code borrowed from Bazaar)[[BR]]
''Author: Greg Ward'' (current maintainer)[[BR]]
''Author: Paul Crowley''<<BR>>
''Author: Ian Clatworthy'' (parser code borrowed from Bazaar)<<BR>>
''Author: Greg Ward'' (current maintainer)<<BR>>
Line 9: Line 9:
Clone URLs:
  *
http://vc.gerg.ca/hg/hg-fastimport/
  * http://bitbucket.org/gward/hg-fastimport/
Repository: http://hg.gerg.ca/hg-fastimport/

Repository:
https://bitbucket.org/gward/hg-fastimport/
Line 18: Line 18:
  * the definitive documentation for the format is [http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html the git-fast-import] man page
  * Bazaar also has [http://bazaar-vcs.org/BzrFastImport a similar plugin]; in fact, much of the code in `hg-fastimport` originated with Bazaar (credit to Ian Clatworthy)
  * the definitive documentation for the format is [[http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html|the git-fast-import]] man page
  * Bazaar also has [[http://bazaar-vcs.org/BzrFastImport|a similar plugin]]; in fact, much of the code in `hg-fastimport` originated with Bazaar (credit to Ian Clatworthy)
Line 23: Line 23:
  1. Clone one of the maintainer's repositories: This assumes you're running on a Unix-like OS. Windows users are on their own for now.

  1. Get the `pyfastimport` library that `hg-fastimport` depends on:
  {{{
hg clone http://vc.gerg.ca/hg/pyfastimport/
}}}
  (Note that the canonical source of `pyfastimport` is a Bazaar branch on launchpad.net, since it's derived from Bazaar code. If you want to contribute patches to `pyfastimport`, start here: `bzr branch lp:~gward/bzr-fastimport/reusable pyfastimport`.
  1. (Optional) Run `pyfastimport`'s test suite:
  {{{
(cd pyfastimport && ./runtests.py)
}}}
  1. Get `hg-fastimport`
Line 27: Line 38:
  1. Ensure that Python can find the `fastimport` package:
  {{{
PYTHONPATH=/path/to/pyfastimport ; export PYTHONPATH
python -c "import fastimport ; print fastimport" # should not crash
}}}
Line 29: Line 45:
fastimport = /path/to/hg-fastimport/fastimport fastimport = /path/to/hg-fastimport/hgfastimport
Line 32: Line 48:

Sorry this is all so cumbersome. The code is still under active development, and I have not spent much time on installation details.
Line 38: Line 56:
hg fastimport SOURCE hg fastimport FILE ...
Line 40: Line 58:
reads a fast-import stream from `SOURCE` and adds changesets to the current repository. For example, to create a brand-new repository from `foo.git-dump`: 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`:
Line 50: Line 68:
Support for "blobs" (a way of specifying file contents independently of commits) is, as of 31 March 2009, brand-new and only lightly tested.   Support for "blobs" (a way of specifying file contents independently of commits) is, as of 31 March 2009, brand-new and only lightly tested.
----
CategoryExtensionsByOthers

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: http://hg.gerg.ca/hg-fastimport/

Repository: https://bitbucket.org/gward/hg-fastimport/

Overview

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.

Links:

  • the definitive documentation for the format is the git-fast-import man page

  • Bazaar also has a similar plugin; in fact, much of the code in hg-fastimport originated with Bazaar (credit to Ian Clatworthy)

Setup

This assumes you're running on a Unix-like OS. Windows users are on their own for now.

  1. Get the pyfastimport library that hg-fastimport depends on:

    hg clone http://vc.gerg.ca/hg/pyfastimport/

    (Note that the canonical source of pyfastimport is a Bazaar branch on launchpad.net, since it's derived from Bazaar code. If you want to contribute patches to pyfastimport, start here: bzr branch lp:~gward/bzr-fastimport/reusable pyfastimport.

  2. (Optional) Run pyfastimport's test suite:

    (cd pyfastimport && ./runtests.py)
  3. Get hg-fastimport

    hg clone http://vc.gerg.ca/hg/hg-fastimport/
  4. Ensure that Python can find the fastimport package:

    PYTHONPATH=/path/to/pyfastimport ; export PYTHONPATH
    python -c "import fastimport ; print fastimport"   # should not crash
  5. Enable the extension by adding this line to [extensions] in ~/.hgrc:

    fastimport = /path/to/hg-fastimport/hgfastimport

(where /path/to/hg-fastimport is the directory created by the clone operation).

Sorry this is all so cumbersome. The code is still under active development, and I have not spent much time on installation details.

Usage

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.

Support for "blobs" (a way of specifying file contents independently of commits) is, as of 31 March 2009, brand-new and only lightly tested.


CategoryExtensionsByOthers

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