6

I have a small project which I started in bazaar, as an exercise to learn bzr. I've since decided I prefer Mercurial. How might I migrate this project to Hg?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
matt wilkie
  • 17,268
  • 24
  • 80
  • 115

2 Answers2

9

I believe your answer can be found here.

Essentially, all that's required is that you run

$ hg convert bzr-repository-URI Target-hg-dir
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mies
  • 281
  • 1
  • 2
  • huh. When I try that I'm told "..\path\to\foo does not look like a Bazaar repository" even though it most definitely is. I'll follow up with the extension folks and see what I find. – matt wilkie Sep 07 '10 at 23:52
4

Miles is correct, unless you are running Windows. The current Windows installers (1.6.3) do not include python bzrlib, so the convert fails with "..\path\to\foo does not look like a Bazaar repository".

After floundering around for awhile and failing to figure out how to acquire bzrlib and tell hg to use it, I used linux, which I have via an ubuntu vmware appliance.

I installed mercurial 1.6 from ppa (the default 1.4 doesn't have convert), enabled convert extension, and ran 'hg convert code/foo foo-from-bzr'. It appeared to work, giving me a summary of the log messages. I was confused for awhile that ./foo-from-bzr was empty except for an .hg directory. After floundering around for awhile I discovered that 'hg update' is needed. So, to recap:

# install mercurial 1.6 on ubuntu 10
sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get install mercurial

# the actual conversion
hg convert path/to/foo-bzr-branch foo-hg
cd foo-hg
hg update

Special thanks to Mads Kiilrich for suggesting linux on the mercurial mailing list.

UPDATE: the solution for converting from bazaar on Windows is "...to install Python with the necessary extra modules and either install Mercurial from source or with the Python-specific installers from http://bitbucket.org/tortoisehg/thg-winbuild/downloads/ - for example mercurial-1.6.3.win32-py2.6.exe " (source)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
matt wilkie
  • 17,268
  • 24
  • 80
  • 115
  • 1
    Matt: I've make a patch for convert that will make it update the converted repository by default. You can add a comment here if you like: http://mercurial.markmail.org/thread/ab3o4lwxxwmzkfni – Martin Geisler Sep 10 '10 at 12:34