<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Migration — Bazaar v2.2.4 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.2.4', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/bzr.ico"/> <link rel="top" title="Bazaar v2.2.4 documentation" href="../index.html" /> <link rel="up" title="Bazaar System Administrator’s Guide" href="index.html" /> <link rel="next" title="Extending Bazaar with Hooks and Plugins" href="hooks-plugins.html" /> <link rel="prev" title="Other Setups" href="other-setups.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="hooks-plugins.html" title="Extending Bazaar with Hooks and Plugins" accesskey="N">next</a></li> <li class="right" > <a href="other-setups.html" title="Other Setups" accesskey="P">previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.2.4)</a> »</li> <li><a href="index.html" accesskey="U">Bazaar System Administrator’s Guide</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="migration"> <h1>Migration<a class="headerlink" href="#migration" title="Permalink to this headline">¶</a></h1> <p>Migrating between version control systems can be a complicated process, and Bazaar has extensive documentation on the process at <a class="reference external" href="http://doc.bazaar.canonical.com/migration/en">http://doc.bazaar.canonical.com/migration/en</a> and we won’t attempt to repeat that here. We will try to give a few motivating examples for conversion from Mercurial and Subversion.</p> <div class="section" id="fast-import"> <h2>Fast Import<a class="headerlink" href="#fast-import" title="Permalink to this headline">¶</a></h2> <p>In many projects wishing to use Bazaar, there is pre-existing history for the codebase that should be taken into consideration. Bazaar leverages an interchange format originally developed for Git called <cite>fast-import</cite> to provide migration strategies for many other version control systems. To work with fast-import files, Bazaar needs the <a class="reference external" href="http://launchpad.net/bzr-fastimport">fastimport</a> plugin. This can be installed as with any Bazaar plugin.</p> <p>The way that fast-import can be used for migration is to export the existing history into a fast-import file, then use the <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">fast-import</span></tt> command. The <cite>fastimport</cite> plugin includes exporters for Subversion, CVS, Git, Mercurial and darcs, accessible as the <tt class="docutils literal"><span class="pre">fast-export-from-XXX</span></tt> commands. Note that <tt class="docutils literal"><span class="pre">fast-import</span></tt> should not be used in a branch with existing history.</p> <p>Assuming that ProjectX was first developed in Mercurial before switching to Bazaar, and that the Mercurial repository is in <tt class="docutils literal"><span class="pre">/srv/hg/projectx</span></tt>, the following commands will import that history into a newly created <tt class="docutils literal"><span class="pre">trunk</span></tt> branch. (Recall that in <a class="reference external" href="simple-setups.html#further-configuration">Further Configuration</a> we created the <tt class="docutils literal"><span class="pre">/srv/bzr/projectx</span></tt> directory as a shared repository.)</p> <div class="highlight-python"><pre>$ cd /srv/bzr/projectx $ bzr fast-export-from-hg ../../hg/projectx projectx.fi $ bzr init trunk $ bzr fast-import projectx.fi trunk</pre> </div> </div> <div class="section" id="subversion-conversion"> <h2>Subversion Conversion<a class="headerlink" href="#subversion-conversion" title="Permalink to this headline">¶</a></h2> <p>As the most common centralized version control system, migration from Subversion is particularly important for any <em>new</em> version control system. Bazaar’s <a class="reference external" href="http://launchpad.net/bzr-svn">svn</a> plugin provides tools for interaction with Subversion projects. In fact, Bazaar can be used transparently with projects stored in Subversion, but that is beyond the scope of this document. (See <a class="reference external" href="http://doc.bazaar.canonical.com/en/migration/foreign/bzr-on-svn-projects.html">http://doc.bazaar.canonical.com/en/migration/foreign/bzr-on-svn-projects.html</a> for more on that subject.) What is relevant here is the <tt class="docutils literal"><span class="pre">svn-import</span></tt> command provided by that plugin. This can import an entire subversion repository including tags and branches, particularly if they are stored in Subversion’s recommended directory structure: <tt class="docutils literal"><span class="pre">/tags/</span></tt>, <tt class="docutils literal"><span class="pre">/branches/</span></tt> and <tt class="docutils literal"><span class="pre">/trunk/</span></tt>.</p> <p>This command has flexible ways to specify what paths within the Subversion repository contain branches and which contain tags. For example, the recommended layout for Subversion projects (called <tt class="docutils literal"><span class="pre">trunk</span></tt> by the svn plugin) could be specified in <tt class="docutils literal"><span class="pre">~/.bazaar/subversion.conf</span></tt> as</p> <div class="highlight-python"><pre>[203ae883-c723-44c9-aabd-cb56e4f81c9a] branches = branches/* tags = tags/*</pre> </div> <p>This allows substantially complicated Subversion repositories to be converted into a set of separate Bazaar branches. After installing the svn plugin, see <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">help</span> <span class="pre">svn-import</span></tt> and <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">help</span> <span class="pre">svn-layout</span></tt>.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Migration</a><ul> <li><a class="reference internal" href="#fast-import">Fast Import</a></li> <li><a class="reference internal" href="#subversion-conversion">Subversion Conversion</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="other-setups.html" title="previous chapter">Other Setups</a></p> <h4>Next topic</h4> <p class="topless"><a href="hooks-plugins.html" title="next chapter">Extending Bazaar with Hooks and Plugins</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/admin-guide/migration.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="hooks-plugins.html" title="Extending Bazaar with Hooks and Plugins" >next</a></li> <li class="right" > <a href="other-setups.html" title="Other Setups" >previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.2.4)</a> »</li> <li><a href="index.html" >Bazaar System Administrator’s Guide</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009, Canonical Ltd. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>