Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > 27647990744ebd9cfe32398f37f67e20 > files > 3037

bzr-2.6.0-11.1.mga5.i586.rpm

<!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>Reusing a checkout &mdash; Bazaar 2.6.0 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.6.0',
        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 2.6.0 documentation" href="../index.html" />
    <link rel="up" title="Bazaar User Guide" href="index.html" />
    <link rel="next" title="Distributed development" href="distributed_intro.html" />
    <link rel="prev" title="Working offline on a central branch" href="working_offline_central.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="distributed_intro.html" title="Distributed development"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="working_offline_central.html" title="Working offline on a central branch"
             accesskey="P">previous</a> |</li>
<li><a href="http://bazaar.canonical.com/">
    <img src="../_static/bzr icon 16.png" /> Home</a>&nbsp;|&nbsp;</li>
<a href="http://doc.bazaar.canonical.com/en/">Documentation</a>&nbsp;|&nbsp;</li>

        <li><a href="../index.html">Table of Contents (2.6.0)</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">Bazaar User Guide</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="reusing-a-checkout">
<h1>Reusing a checkout<a class="headerlink" href="#reusing-a-checkout" title="Permalink to this headline">¶</a></h1>
<div class="section" id="motivation">
<h2>Motivation<a class="headerlink" href="#motivation" title="Permalink to this headline">¶</a></h2>
<p>At times, it can be useful to have a single checkout as your
sandbox for working on multiple branches. Some possible reasons
for this include:</p>
<blockquote>
<div><ul class="simple">
<li>saving disk space when the working tree is large</li>
<li>developing in a fixed location.</li>
</ul>
</div></blockquote>
<p>In many cases, working tree disk usage swamps the size of the
<tt class="docutils literal"><span class="pre">.bzr</span></tt> directory. If you want to work on multiple branches
but can&#8217;t afford the overhead of a full working tree for each,
reusing a checkout across multiples branches is the way to go.</p>
<p>On other occasions, the location of your sandbox might be
configured into numerous development and testing tools. Once
again, reusing a checkout across multiple branches can help.</p>
</div>
<div class="section" id="changing-where-a-branch-is-bound-to">
<h2>Changing where a branch is bound to<a class="headerlink" href="#changing-where-a-branch-is-bound-to" title="Permalink to this headline">¶</a></h2>
<p>To change where a checkout is bound to, follow these steps:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Make sure that any local changes have been committed
centrally so that no work is lost.</li>
<li>Use the <tt class="docutils literal"><span class="pre">bind</span></tt> command giving the URL of the new
remote branch you wish to work on.</li>
<li>Make your checkout a copy of the desired branch by using
the <tt class="docutils literal"><span class="pre">update</span></tt> command followed by the <tt class="docutils literal"><span class="pre">revert</span></tt> command.</li>
</ol>
</div></blockquote>
<p>Note that simply binding to a new branch and running <tt class="docutils literal"><span class="pre">update</span></tt>
merges in your local changes, both committed and uncommitted. You need
to decide whether to keep them or not by running either <tt class="docutils literal"><span class="pre">revert</span></tt>
or <tt class="docutils literal"><span class="pre">commit</span></tt>.</p>
<p>An alternative to the bind+update recipe is using the <tt class="docutils literal"><span class="pre">switch</span></tt>
command. This is basically the same as removing the existing
branch and running <tt class="docutils literal"><span class="pre">checkout</span></tt> again on the new location, except
that any uncommitted changes in your tree are merged in.</p>
<p>Note: As <tt class="docutils literal"><span class="pre">switch</span></tt> can potentially throw away committed changes in
order to make a checkout an accurate cache of a different bound branch,
it will fail by design if there are changes which have been committed
locally but are not yet committed to the most recently bound branch.
To truly abandon these changes, use the <tt class="docutils literal"><span class="pre">--force</span></tt> option.</p>
</div>
<div class="section" id="switching-a-lightweight-checkout">
<h2>Switching a lightweight checkout<a class="headerlink" href="#switching-a-lightweight-checkout" title="Permalink to this headline">¶</a></h2>
<p>With a lightweight checkout, there are no local commits and <tt class="docutils literal"><span class="pre">switch</span></tt>
effectively changes which branch the working tree is associated with.
One possible setup is to use a lightweight checkout in combination
with a local tree-less repository. This lets you switch what you
are working on with ease. For example:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr init-repo --no-trees PROJECT
cd PROJECT
bzr branch bzr+ssh://centralhost/srv/bzr/PROJECT/trunk
bzr checkout --lightweight trunk my-sandbox
cd my-sandbox
(hack away)
</pre></div>
</div>
<p>Note that trunk in this example will have a <tt class="docutils literal"><span class="pre">.bzr</span></tt> directory within it
but there will be no working tree there as the branch was created in
a tree-less repository. You can grab or create as many branches as you
need there and switch between them as required. For example:</p>
<div class="highlight-python"><div class="highlight"><pre>(assuming in my-sandbox)
bzr branch bzr+ssh://centralhost/srv/bzr/PROJECT/PROJECT-1.0 ../PROJECT-1.0
bzr switch ../PROJECT-1.0
(fix bug in 1.0)
bzr commit -m &quot;blah, blah blah&quot;
bzr switch ../trunk
(go back to working on the trunk)
</pre></div>
</div>
<p>Note: The branches may be local only or they may be bound to
remote ones (by creating them with <tt class="docutils literal"><span class="pre">checkout</span></tt> or by using <tt class="docutils literal"><span class="pre">bind</span></tt>
after creating them with <tt class="docutils literal"><span class="pre">branch</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="#">Reusing a checkout</a><ul>
<li><a class="reference internal" href="#motivation">Motivation</a></li>
<li><a class="reference internal" href="#changing-where-a-branch-is-bound-to">Changing where a branch is bound to</a></li>
<li><a class="reference internal" href="#switching-a-lightweight-checkout">Switching a lightweight checkout</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="working_offline_central.html"
                        title="previous chapter">Working offline on a central branch</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="distributed_intro.html"
                        title="next chapter">Distributed development</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/user-guide/reusing_a_checkout.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" />
      <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="distributed_intro.html" title="Distributed development"
             >next</a></li>
        <li class="right" >
          <a href="working_offline_central.html" title="Working offline on a central branch"
             >previous</a> |</li>
<li><a href="http://bazaar.canonical.com/">
    <img src="../_static/bzr icon 16.png" /> Home</a>&nbsp;|&nbsp;</li>
<a href="http://doc.bazaar.canonical.com/en/">Documentation</a>&nbsp;|&nbsp;</li>

        <li><a href="../index.html">Table of Contents (2.6.0)</a> &raquo;</li>

          <li><a href="index.html" >Bazaar User Guide</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2011 Canonical Ltd.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>