Migrating multiple Mercurial branches to Bazaar

John Arbash Meinel john at arbash-meinel.com
Wed Mar 31 15:15:18 BST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gustavo Narea wrote:
> Hi, Gordon.
> 
> On 31/03/10 13:06, Gordon Tyler wrote:
>> Could you describe the commands that you're using to create the Bazaar
>> branches and merge them?
>>   
> 
> Sure:
> 
> $ cd /path/to/repositories
> $ python
> /somewhere/bzrlib/plugins/fastimport/exporters/hg-fast-export.py --repo
> hg-trunk > trunk.fi
> $ python
> /somewhere/bzrlib/plugins/fastimport/exporters/hg-fast-export.py --repo
> hg-trunk-branch > trunk-branch.fi
> $ bzr init bzr-trunk
> $ bzr init bzr-trunk-branch
> $ cd bzr-trunk
> $ bzr fast-import ../trunk.fi
> $ bzr update
> $ cd ../bzr-trunk-branch
> $ bzr fast-import ../trunk-branch.fi
> $ bzr update
> $ cd ../bzr-trunk
> $ bzr merge ../bzr-trunk-branch
> 
> I had to use the front-end directly instead of "bzr fast-export-from-hg"
> because that command wasn't available.
> 
> I'm using bzr 2.1.0 from the PPA for Ubuntu Karmic.
> 
> Cheers,
> 

I think you need to look into using "--export-marks" and "--import-marks".

bzr fast-import isn't "deterministic". So for each import you get new
bzr identifiers.

However, I believe with "--export-marks" fast-import will record what
identifiers it used for a given source object. And then with
"--import-marks" it will skip over ones that have already been imported.

If you have a lot of such branches, then you'll also want to find out if
you can "--export-marks" to the same file that you just imported from.
(Do we read the whole file before writing out new data?) I don't know
for sure, but something like:

cd bzr-trunk
bzr fast-import ../trunk.fi --export-marks ../trunk.marks
cd ../bzr-trunk-branch
bzr fast-import ../trunk-branch.fi --import-marks ../trunk.marks \
  --export-marks ?

Should work.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuzWPYACgkQJdeBCYSNAAPcnQCgjAnkYTcIbQyTnYb4g6kq8GeJ
3DEAn3Uogg9LBuNRXZlRt/Uns+wibf3C
=Ykn9
-----END PGP SIGNATURE-----



More information about the bazaar mailing list