Migrate from Mercurial

Tuesday, May 15, 2012 0 Comments

Here it comes: A new entry about how to migrate your existing repository into Plastic SCM! This time, the unwitting subject of our inquiry is .... Mercurial!

Things we need:
  • An Hg repository
  • Git installed
  • Plastic SCM

Hg-Fast-Export Tool

Download the hg-fast-export tool from HERE. This Python tool will allow us to migrate the Hg repository to a Git repository. Download and decompress the tool, then issue the following commands to migrate the repository into Git.

$ ...
$ mkdir hg_migrated_repository
$ cd hg_migrated_repository
$ git init
$ /path/to/hg-fast-export.sh -r /path/to/hg_repo
$ ...

I know this seems a bit roundabout, so let me explain. The hg-fast-export tool creates an import package that's in the old standard "inline" format. Plastic SCM does not support that format yet (though we plan on it soon!), instead opting to support Git's newer and more efficient import package format. Git is then the logical go-between to get from Hg to our very own Plastic SCM.

Import to Plastic SCM

As you know from previous blog posts, you only need to fast-export the Git repository and finally fast-import it into Plastic SCM. Here's a refresher:

$ ...
$ git fast-export --all -C --tag-of-filtered-object=drop --signed-tags=strip > repo.fe
$ cm fast-import myHgrepo@localhost:8087 repo.fe
$ ...

And that's all! Easy, right?

0 comentarios: