Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

Rendering of reStructured text is not possible, please install Docutils.

=========================
Convert from Git Scenario
=========================

*[DRAFT: this page is still being reviewed by bzr experts for correctness.]*

Suppose you want to convert a repository maintained in Git to bzr.  We'll assume you already have git installed.  Here's an overview of how you'd do it:

1) Install the bzr-fastimport plugin.
2) Create a bzr repo to host the corresponding bzr branches
3) Use git's fast-export_ to export a formatted version of the repository's history.
4) Use bzr's fast-import_ plugin to import the formatted version to recreate the repository.

Assume that your git repository is in ``git-repo`` and you wish to make corresponding bzr branches for all git branches in a bzr repository at ``bzr-repo``.  

First we need to install bzr's ``fast-import`` plugin.  This plugin is not shipped as part of the bzr installation.  If you have not yet installed it, the following commands will fetch and install the latest version from its home on launchpad_::

   $ cd ~/.bazaar/plugins
   $ bzr branch lp:bzr-fastimport fastimport

You'll then need to create the bzr repository::

   $ bzr init-repo bzr-repo

Then use git's ``fast-export`` to export all the branches, and use bzr's fast-import plugin to import and recreate the branches::

   $ git fast-export -M --all | (cd bzr-repo; bzr fast-import -)

In the above, we used git ``fast-export``'s ``-M`` flag to embed git's inferred file-renames into the formatted output; you may wish to drop this.

Bzr's ``fast-import`` plugin periodically checkpoints its progress.  If the import is interrupted or should crash, you can restart import and the plugin will skip over the already-loaded versions.

See ``bzr help fast-import`` for more information.

.. _fast-export: http://www.kernel.org/pub/software/scm/git-core/docs/git-fast-export.html
.. _fast-import: BzrFastImport
.. _launchpad: https://launchpad.net/bzr-fastimport


Additional Notes
=================

Large Repositories
------------------

For large repositories, you may get better performance by allowing bzr's fast-import to do some initial pre-processing to generate some caching hints::

   $ git fast-export -M --all > exported.fi
   $ bzr fast-import-info -v exported.fi > exported.cfg
   $ bzr fast-import exported.fi --info exported.cfg


Git Repositories with Signed Tags
---------------------------------

Git allows creating signed tags; these tags will have a different signature when exported.  If your export fails because of a signed tag, simply add '--signed-tags=warn' to the git fast-export::

   $ git fast-export -M --all --signed-tags=warn | (cd bzr-repo; bzr fast-import -)