Importing from mercurial (some quirks and working recipe)

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Wed Jan 30 18:09:25 GMT 2008


Hello, everybody.

I am currently using Mercurial, but decided to take a look at bazaar.
My first idea was of course to convert some of my existing mercurial
repos and play a bit with that. I faced some problems, so here is the
working recipe

a) Install bzr 1.1.0, bzr 0.9 won't work. In my case it meant grabbing
launchpad ubuntu packages and using them in favor of standard ubuntu bzr.

b) Grab hg-import plugin

 mkdir ~/.bazaar/plugins
 bzr branch https://code.launchpad.net/~luks/+junk/bzr-hgimport
 mv bzr-hgimport hgimport
 # crucial, directory name can't contain -

c) Create new bazaar repo

 bzr init newdirectory
 cd newdirectory

d) Import

 bzr hg-import /path/to/mercurial/dir

(nice progressbar follows)

That's all, it works.


Now about some quirks

1) After the above, I commited some changes to the mercurial repo and
tried to re-issue bzr hg-import. Some new change was grabbed, but is
clearly incomplete (only one file was changed, the rest changes wasn't
taken). So it seems hg-import does not handle incremental updates
(well, it did not promise IIRC, but it could warn about it)

2) When I tried issuing bzr hg-import in directory init-ed with bzr 0.9
(created before I updated to 1.1.0), it worked for a long time to finally
crash with incredibly cryptic error message:

bzr: ERROR: Tags not supported by BzrBranch5('file:///home/marcink/tmp/TESTST/szachy_partie_moje.bzr/'); you may be able to use bzr upgrade --dirstate-tags.

It was just a bit of luck that I guessed that above means "You must
use newer repository format" ;-)

3) I also tried bzr-hg (alternative plugin). This one seems to provide direct
bzr branch /path/to/mercurial/repo command, but ... crashes with (the crash is the same whether I use bzr 0.9, or 1.1.0):

 
bzr: ERROR: exceptions.AttributeError: 'HgBzrDirFormat' object has no attribute '_workingtree_format'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 806, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 762, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 907, in run
    accelerator_tree=accelerator_tree)
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 913, in sprout
    cloning_format = self.cloning_metadir()
  File "/usr/lib/python2.5/site-packages/bzrlib/bzrdir.py", line 881, in cloning_metadir
    if format._workingtree_format is None:
AttributeError: 'HgBzrDirFormat' object has no attribute '_workingtree_format'

bzr 1.1.0 on python 2.5.1.final.0 (linux2)
arguments: ['/usr/bin/bzr', 'branch', 'szachy_partie_moje', 'szachy_partie_moje.bzr']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  builddeb             /usr/lib/python2.5/site-packages/bzrlib/plugins/builddeb [unknown]
  bzr_hg               /home/marcink/.bazaar/plugins/bzr_hg [unknown]
  bzrtools             /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.1.0]
  email                /usr/lib/python2.5/site-packages/bzrlib/plugins/email [unknown]
  gtk                  /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.93.0]
  hgimport             /home/marcink/.bazaar/plugins/hgimport [unknown]
  launchpad            /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  multiparent          /usr/lib/python2.5/site-packages/bzrlib/plugins/multiparent.pyc [unknown]
  pqm                  /usr/lib/python2.5/site-packages/bzrlib/plugins/pqm [unknown]
  svn                  /usr/lib/python2.5/site-packages/bzrlib/plugins/svn [0.4.6]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.


-- 
----------------------------------------------------------------------
| Marcin Kasperski   |   The goal of a software process is the
| http://mekk.waw.pl | production of software (...) Intermediate
|                    | artifacts are not the goal (Booch,Martin)
----------------------------------------------------------------------




More information about the bazaar mailing list