Sophie

Sophie

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

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>Merging changes &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="Resolving conflicts" href="resolving_conflicts.html" />
    <link rel="prev" title="Branching a project" href="branching_a_project.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="resolving_conflicts.html" title="Resolving conflicts"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="branching_a_project.html" title="Branching a project"
             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="merging-changes">
<h1>Merging changes<a class="headerlink" href="#merging-changes" title="Permalink to this headline">¶</a></h1>
<div class="section" id="parallel-development">
<h2>Parallel development<a class="headerlink" href="#parallel-development" title="Permalink to this headline">¶</a></h2>
<p>Once someone has their own branch of a project, they can make
and commit changes in parallel to any development proceeding
on the original branch. Pretty soon though, these independent
lines of development will need to be combined again. This
process is known as <em>merging</em>.</p>
</div>
<div class="section" id="the-merge-command">
<h2>The merge command<a class="headerlink" href="#the-merge-command" title="Permalink to this headline">¶</a></h2>
<p>To incorporate changes from another branch, use the <tt class="docutils literal"><span class="pre">merge</span></tt> command.
Its syntax is:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge [URL]
</pre></div>
</div>
<p>If no URL is given, a default is used, initially the branch this branch
originated from.
For example, if Bill made a branch from Mary&#8217;s work, he can merge her
subsequent changes by simply typing this:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge
</pre></div>
</div>
<p>On the other hand, Mary might want to merge into her branch the work Bill
has done in his. In this case, she needs to explicitly give the URL the
first time, e.g.:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge bzr+ssh://mary@bill-laptop/cool-repo/cool-trunk
</pre></div>
</div>
<p>This sets the default merge branch if one is not already set.  Use
<tt class="docutils literal"><span class="pre">--no-remember</span></tt> to avoid setting it. To change the default after it is set,
use the <tt class="docutils literal"><span class="pre">--remember</span></tt> option.</p>
</div>
<div class="section" id="how-does-merging-work">
<h2>How does merging work?<a class="headerlink" href="#how-does-merging-work" title="Permalink to this headline">¶</a></h2>
<p>A variety of algorithms exist for merging changes. Bazaar&#8217;s
default algorithm is a variation of <em>3-way merging</em> which
works as follows. Given an ancestor A and two branches B and C,
the following table provides the rules used.</p>
<blockquote>
<div><table border="1" class="docutils">
<colgroup>
<col width="9%" />
<col width="9%" />
<col width="9%" />
<col width="19%" />
<col width="53%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">A</th>
<th class="head">B</th>
<th class="head">C</th>
<th class="head">Result</th>
<th class="head">Comment</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>x</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>unchanged</td>
</tr>
<tr class="row-odd"><td>x</td>
<td>x</td>
<td>y</td>
<td>y</td>
<td>line from C</td>
</tr>
<tr class="row-even"><td>x</td>
<td>y</td>
<td>x</td>
<td>y</td>
<td>line from B</td>
</tr>
<tr class="row-odd"><td>x</td>
<td>y</td>
<td>z</td>
<td>?</td>
<td>conflict</td>
</tr>
</tbody>
</table>
</div></blockquote>
<p>Note that some merges can only be completed with the assistance
of a human. Details on how to resolve these are given in
<a class="reference external" href="resolving_conflicts.html">Resolving conflicts</a>.</p>
</div>
<div class="section" id="recording-a-merge">
<h2>Recording a merge<a class="headerlink" href="#recording-a-merge" title="Permalink to this headline">¶</a></h2>
<p>After any conflicts are resolved, the merge needs to be committed.
For example:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr commit -m &quot;Merged Mary&#39;s changes&quot;
</pre></div>
</div>
<p>Even if there are no conflicts, an explicit commit is still required.
Unlike some other tools, this is considered a feature in Bazaar.
A clean merge is not necessarily a good merge so making the commit
a separate explicit step allows you to run your test suite first to
verify all is good. If problems are found, you should correct them
before committing the merge or throw the merge away using <tt class="docutils literal"><span class="pre">revert</span></tt>.</p>
</div>
<div class="section" id="merge-tracking">
<h2>Merge tracking<a class="headerlink" href="#merge-tracking" title="Permalink to this headline">¶</a></h2>
<p>One of the most important features of Bazaar is distributed,
high quality <em>merge tracking</em>.
In other words, Bazaar remembers what has been merged already and
uses that information to intelligently choose the best ancestor for
a merge, minimizing the number and size of conflicts.</p>
<p>If you are a refugee from many other VCS tools, it can be really
hard to &#8220;unlearn&#8221; the <em>please-let-me-avoid-merging-at-any-cost</em> habit.
Bazaar lets you safely merge as often as you like with other people.
By working in a peer-to-peer manner when it makes sense to do so, you
also avoid using a central branch as an &#8220;integration swamp&#8221;, keeping
its quality higher. When the change you&#8217;re collaborating on is
truly ready for wider sharing, that&#8217;s the time to merge and commit
it to a central branch, not before.</p>
<p>Merging that Just Works truly can change how developers work together.</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="#">Merging changes</a><ul>
<li><a class="reference internal" href="#parallel-development">Parallel development</a></li>
<li><a class="reference internal" href="#the-merge-command">The merge command</a></li>
<li><a class="reference internal" href="#how-does-merging-work">How does merging work?</a></li>
<li><a class="reference internal" href="#recording-a-merge">Recording a merge</a></li>
<li><a class="reference internal" href="#merge-tracking">Merge tracking</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="branching_a_project.html"
                        title="previous chapter">Branching a project</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="resolving_conflicts.html"
                        title="next chapter">Resolving conflicts</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/user-guide/merging_changes.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="resolving_conflicts.html" title="Resolving conflicts"
             >next</a></li>
        <li class="right" >
          <a href="branching_a_project.html" title="Branching a project"
             >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>