Sophie

Sophie

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

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>Pseudo merging &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="Switch –store" href="switch_store.html" />
    <link rel="prev" title="The journey ahead" href="part2_intro.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="switch_store.html" title="Switch –store"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="part2_intro.html" title="The journey ahead"
             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="pseudo-merging">
<h1>Pseudo merging<a class="headerlink" href="#pseudo-merging" title="Permalink to this headline">¶</a></h1>
<div class="section" id="cherrypicking">
<h2>Cherrypicking<a class="headerlink" href="#cherrypicking" title="Permalink to this headline">¶</a></h2>
<p>At times, it can be useful to selectively merge some of the changes
in a branch, but not all of them. This is commonly referred to as
<em>cherrypicking</em>. Here are some examples of where cherrypicking is
useful:</p>
<ul class="simple">
<li>selectively taking fixes from the main development branch into
a release branch</li>
<li>selectively taking improvements out of an experimental branch into
a feature branch.</li>
</ul>
<p>To merge only the changes made by revision X in branch <tt class="docutils literal"><span class="pre">foo</span></tt>,
the command is:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge -c X foo
</pre></div>
</div>
<p>To merge only the changes up to revision X in branch <tt class="docutils literal"><span class="pre">foo</span></tt>,
the command is:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge -r X foo
</pre></div>
</div>
<p>To merge only the changes since revision X in branch <tt class="docutils literal"><span class="pre">foo</span></tt>,
the command is:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge -r X.. foo
</pre></div>
</div>
<p>To merge only the changes from revision X to revision Y in branch <tt class="docutils literal"><span class="pre">foo</span></tt>,
the command is:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge -r X..Y foo
</pre></div>
</div>
<p>Like a normal merge, you must explicitly commit a cherrypick. You may wish
to see the changes made using <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">diff</span></tt>, and run your test suite if any,
before doing this.</p>
<p>Unlike a normal merge, Bazaar does not currently track cherrypicks.
In particular, the changes look like a normal commit and the (internal)
revision history of the changes from the other branch is lost.
In many cases where they are useful (see above), this is not a major
problem because there are good reasons why a full merge should never
be done at a later time. In other cases, additional conflicts will need
to be resolved when the changes are merged again.</p>
</div>
<div class="section" id="merging-without-parents">
<h2>Merging without parents<a class="headerlink" href="#merging-without-parents" title="Permalink to this headline">¶</a></h2>
<p>A related technique to cherrypicking, in that it makes changes without
reference to the revisions that they came from is to perform a merge, but
forget about the parent revisions before committing.  This has the effect of
making all of the changes that would have been in the merge happen in a single
commit.  After the merge and before the corresponding commit, you can do:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr revert --forget-merges
</pre></div>
</div>
<p>to keep the changes in the working tree, but remove the record of the
revisions where the changes originated.  The next commit would then record
all of those changes without any record of the merged revisions.</p>
<p>This is desired by some users to make their history &#8220;cleaner&#8221;, but you should
be careful that the loss of history does not outweigh the value of cleanliness,
particularly given Bazaar&#8217;s capabilities for progressively disclosing merged
revisions.  In particular, because this will include the changes from the
source branch, but without attribution to that branch, it can lead to
additional conflicts on later merges that involve the same source and
target branches.</p>
</div>
<div class="section" id="reverse-cherrypicking">
<h2>Reverse cherrypicking<a class="headerlink" href="#reverse-cherrypicking" title="Permalink to this headline">¶</a></h2>
<p>Cherrypicking can be used to reverse a set of changes made by giving an
upper bound in the revision range which is <em>below</em> the lower bound.
For example, to back-out changes made in revision 10, the command is:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr merge -r 10..9
</pre></div>
</div>
<p>If you want to take most changes, but not all, from somewhere else, you
may wish to do a normal merge followed by a few reverse cherrypicks.</p>
</div>
<div class="section" id="merging-uncommitted-changes">
<h2>Merging uncommitted changes<a class="headerlink" href="#merging-uncommitted-changes" title="Permalink to this headline">¶</a></h2>
<p>If you have several branches and you accidentally start making changes in the
wrong one, here are the steps to take to correct this. Assuming you began
working in branch <tt class="docutils literal"><span class="pre">foo</span></tt> when you meant to work in branch <tt class="docutils literal"><span class="pre">bar</span></tt>:</p>
<ol class="arabic simple">
<li>Change into branch <tt class="docutils literal"><span class="pre">bar</span></tt>.</li>
<li>Run <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">merge</span> <span class="pre">--uncommitted</span> <span class="pre">foo</span></tt></li>
<li>Check the changes came across (<tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">diff</span></tt>)</li>
<li>Change into branch <tt class="docutils literal"><span class="pre">foo</span></tt></li>
<li>Run <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">revert</span></tt>.</li>
</ol>
</div>
<div class="section" id="rebasing">
<h2>Rebasing<a class="headerlink" href="#rebasing" title="Permalink to this headline">¶</a></h2>
<p>Another option to normal merging is <em>rebasing</em>, i.e. making it look like
the current branch originated from a different point than it did.
Rebasing is supported in Bazaar by the <tt class="docutils literal"><span class="pre">rebase</span></tt> command provided by
the <tt class="docutils literal"><span class="pre">rebase</span></tt> plugin.</p>
<p>The <tt class="docutils literal"><span class="pre">rebase</span></tt> command takes the location of another branch on which
the branch in the current working directory will be rebased. If a branch
is not specified then the parent branch is used, and this is usually the
desired result.</p>
<p>The first step identifies the revisions that are in the current branch
that are not in the parent branch. The current branch is then set to be
at the same revision as the target branch, and each revision is replayed
on top of the branch. At the end of the process it will appear as though
your current branch was branched off the current last revision of the target.</p>
<p>Each revision that is replayed may cause conflicts in the tree. If this
happens the command will stop and allow you to fix them up. Resolve the
commits as you would for a <tt class="docutils literal"><span class="pre">merge</span></tt>, and then run <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">resolve</span></tt> to
marked them as resolved. Once you have resolved all the conflicts, you
should run <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">rebase-continue</span></tt> to continue the rebase operation.
If conflicts are encountered and you decide not to continue,
you can run <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">rebase-abort</span></tt>. You can also use <tt class="docutils literal"><span class="pre">rebase-todo</span></tt> to
show the list of commits still to be replayed.</p>
<p>Note: Some users coming from central VCS tools with poor merge tracking
like rebasing because it&#8217;s similar to how they are use to working in older
tools, or because &#8220;perfectly clean&#8221; history seems important. Before rebasing
in Bazaar, think about whether a normal merge is a better choice. In
particular, rebasing a private branch before sharing it is OK but
rebasing after sharing a branch with someone else is <strong>strongly</strong> discouraged.</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="#">Pseudo merging</a><ul>
<li><a class="reference internal" href="#cherrypicking">Cherrypicking</a></li>
<li><a class="reference internal" href="#merging-without-parents">Merging without parents</a></li>
<li><a class="reference internal" href="#reverse-cherrypicking">Reverse cherrypicking</a></li>
<li><a class="reference internal" href="#merging-uncommitted-changes">Merging uncommitted changes</a></li>
<li><a class="reference internal" href="#rebasing">Rebasing</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="part2_intro.html"
                        title="previous chapter">The journey ahead</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="switch_store.html"
                        title="next chapter">Switch &#8211;store</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/user-guide/adv_merging.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="switch_store.html" title="Switch –store"
             >next</a></li>
        <li class="right" >
          <a href="part2_intro.html" title="The journey ahead"
             >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>