Sophie

Sophie

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

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>Organizing branches &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="Using gatekeepers" href="using_gatekeepers.html" />
    <link rel="prev" title="Distributed development" href="distributed_intro.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="using_gatekeepers.html" title="Using gatekeepers"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="distributed_intro.html" title="Distributed development"
             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="organizing-branches">
<h1>Organizing branches<a class="headerlink" href="#organizing-branches" title="Permalink to this headline">¶</a></h1>
<div class="section" id="mirror-branches">
<h2>Mirror branches<a class="headerlink" href="#mirror-branches" title="Permalink to this headline">¶</a></h2>
<p>A primary difference when using distributed workflows to
develop is that your main local branch is not the place
to make changes. Instead, it is kept as a pristine copy
of the central branch, i.e. it&#8217;s a <em>mirror branch</em>.</p>
<p>To create a mirror branch, set-up a shared repository
(if you haven&#8217;t already) and then use the <tt class="docutils literal"><span class="pre">branch</span></tt>
(or <tt class="docutils literal"><span class="pre">checkout</span></tt>) command to create the mirror.
For example:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr init-repo PROJECT
cd PROJECT
bzr branch bzr+ssh://centralhost/srv/bzr/PROJECT/trunk
</pre></div>
</div>
</div>
<div class="section" id="task-branches">
<h2>Task branches<a class="headerlink" href="#task-branches" title="Permalink to this headline">¶</a></h2>
<p>Each new feature or fix is developed in its own branch.
These branches are referred to as <em>feature branches</em> or
<em>task branches</em> - the terms are used interchangeably.</p>
<p>To create a task branch, use the <tt class="docutils literal"><span class="pre">branch</span></tt> command
against your mirror branch. For example:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr branch trunk fix-123
cd fix-123
(hack, hack, hack)
</pre></div>
</div>
<p>There are numerous advantages to this approach:</p>
<blockquote>
<div><ol class="arabic simple">
<li>You can work on multiple changes in parallel</li>
<li>There is reduced coupling between changes</li>
<li>Multiple people can work in a peer-to-peer mode
on a branch until it is ready to go.</li>
</ol>
</div></blockquote>
<p>In particular, some changes take longer to cook than others
so you can ask for reviews, apply feedback, ask for another
review, etc. By completing work to sufficient quality in
separate branches before merging into a central branch, the
quality and stability of the central branch are maintained
at higher level than they otherwise would be.</p>
</div>
<div class="section" id="refreshing-a-mirror-branch">
<h2>Refreshing a mirror branch<a class="headerlink" href="#refreshing-a-mirror-branch" title="Permalink to this headline">¶</a></h2>
<p>Use the <tt class="docutils literal"><span class="pre">pull</span></tt> command to do this:</p>
<div class="highlight-python"><div class="highlight"><pre>cd trunk
bzr pull
</pre></div>
</div>
</div>
<div class="section" id="merging-the-latest-trunk-into-a-feature-branch">
<h2>Merging the latest trunk into a feature branch<a class="headerlink" href="#merging-the-latest-trunk-into-a-feature-branch" title="Permalink to this headline">¶</a></h2>
<p>Use the <tt class="docutils literal"><span class="pre">merge</span></tt> command to do this:</p>
<div class="highlight-python"><div class="highlight"><pre>cd fix-123
bzr merge
(resolve any conflicts)
bzr commit -m &quot;merged trunk&quot;
</pre></div>
</div>
</div>
<div class="section" id="merging-a-feature-into-the-trunk">
<h2>Merging a feature into the trunk<a class="headerlink" href="#merging-a-feature-into-the-trunk" title="Permalink to this headline">¶</a></h2>
<p>The policies for different distributed workflows vary here.
The simple case where all developers have commit rights to
the main trunk are shown below.</p>
<p>If your mirror is a checkout:</p>
<div class="highlight-python"><div class="highlight"><pre>cd trunk
bzr update
bzr merge ../fix-123
(resolve any conflicts)
bzr commit -m &quot;Fixed bug #123&quot;
</pre></div>
</div>
<p>If your mirror is a branch:</p>
<div class="highlight-python"><div class="highlight"><pre>cd trunk
bzr pull
bzr merge ../fix-123
(resolve any conflicts)
bzr commit -m &quot;Fixed bug #123&quot;
bzr push
</pre></div>
</div>
</div>
<div class="section" id="backing-up-task-branches">
<h2>Backing up task branches<a class="headerlink" href="#backing-up-task-branches" title="Permalink to this headline">¶</a></h2>
<p>One of the side effects of centralized workflows is that changes
get frequently committed to a central location which is backed up as
part of normal IT operations. When developing on task branches,
it is a good idea to publish your work to a central location
(but not necessarily a shared location) that will be backed up.
You may even wish to bind local task branches to remote ones
established on a backup server just for this purpose.</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="#">Organizing branches</a><ul>
<li><a class="reference internal" href="#mirror-branches">Mirror branches</a></li>
<li><a class="reference internal" href="#task-branches">Task branches</a></li>
<li><a class="reference internal" href="#refreshing-a-mirror-branch">Refreshing a mirror branch</a></li>
<li><a class="reference internal" href="#merging-the-latest-trunk-into-a-feature-branch">Merging the latest trunk into a feature branch</a></li>
<li><a class="reference internal" href="#merging-a-feature-into-the-trunk">Merging a feature into the trunk</a></li>
<li><a class="reference internal" href="#backing-up-task-branches">Backing up task branches</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="distributed_intro.html"
                        title="previous chapter">Distributed development</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="using_gatekeepers.html"
                        title="next chapter">Using gatekeepers</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/user-guide/organizing_branches.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="using_gatekeepers.html" title="Using gatekeepers"
             >next</a></li>
        <li class="right" >
          <a href="distributed_intro.html" title="Distributed development"
             >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>