Sophie

Sophie

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

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>Bazaar in five minutes &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="Tutorials" href="../tutorials/index.html" />
    <link rel="next" title="Bazaar Tutorial" href="../tutorials/tutorial.html" />
    <link rel="prev" title="Tutorials" href="../tutorials/index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../tutorials/tutorial.html" title="Bazaar Tutorial"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="../tutorials/index.html" title="Tutorials"
             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="../tutorials/index.html" accesskey="U">Tutorials</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="bazaar-in-five-minutes">
<h1>Bazaar in five minutes<a class="headerlink" href="#bazaar-in-five-minutes" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>Bazaar is a distributed version control system that makes it easier for
people to work together on software projects.</p>
<p>Over the next five minutes, you&#8217;ll learn how to put your files under
version control, how to record changes to them, examine your work, publish
it and send your work for merger into a project&#8217;s trunk.</p>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h2>
<p>This guide doesn&#8217;t describe how to install Bazaar but it&#8217;s usually very
easy. You can find installation instructions at:</p>
<ul class="simple">
<li><strong>GNU/Linux:</strong> Bazaar is probably in your GNU/Linux distribution already.</li>
<li><strong>Windows:</strong> <a class="reference external" href="http://wiki.bazaar.canonical.com/WindowsDownloads">installation instructions for Windows</a>.</li>
<li><strong>Mac OS X:</strong> <a class="reference external" href="http://wiki.bazaar.canonical.com/MacOSXBundle">installation instructions for Mac OS X</a>.</li>
</ul>
<p>For other platforms and to install from source code, see the <a class="reference external" href="http://wiki.bazaar.canonical.com/Download">Download</a>
and <a class="reference external" href="http://wiki.bazaar.canonical.com/InstallationFaq">Installation</a> pages.</p>
</div>
<div class="section" id="introducing-yourself">
<h2>Introducing yourself<a class="headerlink" href="#introducing-yourself" title="Permalink to this headline">¶</a></h2>
<p>Bazaar records changes to source code, and it records who made the change.
The person is identified by their name and email address.  (If you&#8217;re
concerned about spam, you don&#8217;t need to use a real address that you
actually read, but the convention is that it looks like an email address.)</p>
<p>Before you start working, let&#8217;s tell Bazaar who you are.  Using your name
and email address, instead of John Doe&#8217;s, type:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr whoami &quot;John Doe &lt;john.doe@gmail.com&gt;&quot;
</pre></div>
</div>
<p>You can check what identity is stored in Bazaar&#8217;s configuration:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr whoami
John Doe &lt;john.doe@gmail.com&gt;
</pre></div>
</div>
</div>
<div class="section" id="starting-a-new-project">
<h2>Starting a new project<a class="headerlink" href="#starting-a-new-project" title="Permalink to this headline">¶</a></h2>
<p>Let&#8217;s suppose we want to store a new project under Bazaar.  First, we&#8217;ll
make a <em>repository directory</em> to hold all our work related to this
project, where developers can create branches to test development of
specific features or, more generally, modifications to the working file
set.</p>
<p>After creating the repository, change to that directory, and create the
project&#8217;s main trunk branch.</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr init-repo sample
Shared repository with trees (format: 2a)
Location:
  shared repository: sample
$ bzr init sample/trunk
$ cd sample/trunk
Created a repository tree (format: 2a)
Using shared repository: /home/john/sample/
</pre></div>
</div>
</div>
<div class="section" id="adding-files">
<h2>Adding files<a class="headerlink" href="#adding-files" title="Permalink to this headline">¶</a></h2>
<p>Now that we have the trunk, we need to move to that directory and
create some example files for the first version of that project.  Create
a file <tt class="docutils literal"><span class="pre">test1.txt</span></tt> using a text editor (like emacs, nano, or notepad),
and save it.  Then we&#8217;ll &#8220;add&#8221; the file, which tells bzr we want it to
track changes:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr add test1.txt
</pre></div>
</div>
<p>and then commit, which saves a snapshot of all versioned files:</p>
<div class="highlight-python"><div class="highlight"><pre>bzr commit -m &quot;Added first line of text&quot;
</pre></div>
</div>
</div>
<div class="section" id="making-changes-to-your-files">
<h2>Making changes to your files<a class="headerlink" href="#making-changes-to-your-files" title="Permalink to this headline">¶</a></h2>
<p>Let&#8217;s change a file and commit that change to your branch.</p>
<p>Edit <tt class="docutils literal"><span class="pre">test1.txt</span></tt> in your favourite editor, then use <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">add</span></tt> to tell bzr
to track changes to this file</p>
<div class="highlight-python"><div class="highlight"><pre>$ echo test test test &gt; test1.txt
$ bzr add test1.txt
adding test1.txt
</pre></div>
</div>
<p><cite>bzr diff</cite> shows the changes between the last revision in this branch, and your
current tree (or, with the <tt class="docutils literal"><span class="pre">-r</span></tt> option, between any two trees).</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr diff
=== modified file &#39;test1.txt&#39;
--- test1.txt   2007-10-08 17:56:14 +0000
+++ test1.txt   2007-10-08 17:46:22 +0000
@@ -0,0 +1,1 @@
+test test test
</pre></div>
</div>
<p>Commit your work to the Bazaar branch:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr commit -m &quot;Added first line of text&quot;
Committing to: /home/john/sample/trunk/
added test1.txt
Committed revision 1.
</pre></div>
</div>
</div>
<div class="section" id="viewing-the-revision-log">
<h2>Viewing the revision log<a class="headerlink" href="#viewing-the-revision-log" title="Permalink to this headline">¶</a></h2>
<p>You can see the history of your branch by browsing its log:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr log
revno: 1
committer: John Doe &lt;john.doe@gmail.com&gt;
branch nick: trunk
timestamp: Mon 2006-10-08 17:46:22 +0000
message:
  Initial import
</pre></div>
</div>
</div>
<div class="section" id="publishing-your-branch-on-launchpad">
<h2>Publishing your branch on Launchpad<a class="headerlink" href="#publishing-your-branch-on-launchpad" title="Permalink to this headline">¶</a></h2>
<p>Launchpad is a suite of development and hosting tools for
software projects. You can use it to publish your branch.  (You can
also publish branches onto your own server or other hosting services.)</p>
<p>The steps to publishing branches on Launchpad are:</p>
<ol class="arabic simple">
<li>Create a Launchpad account: visit the <a class="reference external" href="https://launchpad.net/+login">Launchpad login page</a> and choose to create a new account.</li>
</ol>
<ol class="arabic" start="2">
<li><p class="first">Bazaar uses the SSH encryption and authentication protocol to connect
to Launchpad.  You need to first <a class="reference external" href="https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair">create an SSH key</a> on your own computer,
by running the command:</p>
<div class="highlight-python"><div class="highlight"><pre>$ ssh-keygen
</pre></div>
</div>
</li>
</ol>
<ol class="arabic simple" start="3">
<li><a class="reference external" href="https://launchpad.net/~/+editsshkeys">Upload your SSH public key to Launchpad</a>.</li>
</ol>
<ol class="arabic simple" start="4">
<li><a class="reference external" href="https://help.launchpad.net/Teams/CreatingAndRunning">Make a team for your project</a>.  Even if you&#8217;re starting as the only
developer on this project, creating a new now will let you more easily
add other people later.</li>
</ol>
<ol class="arabic simple" start="5">
<li><a class="reference external" href="https://help.launchpad.net/Projects/Registering">Create a project</a>.</li>
</ol>
<ol class="arabic" start="6">
<li><p class="first">Tell Bazaar your Launchpad account name.  If your account is john.doe, type</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr launchpad-login john.doe
</pre></div>
</div>
</li>
<li><p class="first"><a class="reference external" href="https://help.launchpad.net/Code/UploadingABranch">Push the branch for your project</a>.  Once you&#8217;ve committed your changes
locally, you can publish them as the trunk of your new project by saying</p>
<blockquote>
<div><p>$ bzr push lp:~sample-developers/sample/trunk</p>
</div></blockquote>
<p>(Of course, using the team and project names you just chose.)</p>
</li>
</ol>
</div>
<div class="section" id="creating-your-own-copy-of-another-branch">
<h2>Creating your own copy of another branch<a class="headerlink" href="#creating-your-own-copy-of-another-branch" title="Permalink to this headline">¶</a></h2>
<p>To work with someone else&#8217;s code, you can make your own copy of their
branch. Let&#8217;s take a real-world example, Bazaar&#8217;s GTK interface:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr init-repo ~/bzr-gtk
$ bzr branch lp:~bzr/bzr-gtk/trunk ~/bzr-gtk/john
Branched 292 revision(s).
</pre></div>
</div>
<p>Bazaar will download all the files and complete revision history from the
bzr-gtk project&#8217;s trunk branch and create a copy called <tt class="docutils literal"><span class="pre">john</span></tt>.</p>
<p>Now, you have your own copy of the branch and can commit changes with
or without a net connection. You can share your branch at any time by
publishing it and, if the  bzr-gtk team want to use your work, Bazaar
makes it easy for them to merge your branch back into their trunk branch.</p>
</div>
<div class="section" id="updating-your-branch-from-the-main-branch">
<h2>Updating your branch from the main branch<a class="headerlink" href="#updating-your-branch-from-the-main-branch" title="Permalink to this headline">¶</a></h2>
<p>While you commit changes to your branch, it&#8217;s likely that other people will
also continue to commit code to the parent branch.</p>
<p>To make sure your branch stays up to date, you should merge changes from
the parent into your personal branch:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr merge
Merging from saved parent location: http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk
All changes applied successfully.
</pre></div>
</div>
<p>Check what has changed:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr diff
</pre></div>
</div>
<p>If different branches have made changes to the same areas of the same
files, then merging them may generate conflicts.  When this happens,
Bazaar puts text markers like <tt class="docutils literal"><span class="pre">&lt;&lt;&lt;&lt;&lt;&lt;&lt;</span></tt> into the files, and records them
in a list of conflicted files.  You should edit the files to reflect the
way you want to resolve the conflicts, use <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">diff</span></tt> to check the
changes, and then <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">resolve</span></tt> to mark them as resolved.</p>
<p>If you&#8217;re happy with the changes, you can commit them to your personal
branch:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr commit -m &quot;Merge from main branch&quot;
Committed revision 295.
</pre></div>
</div>
</div>
<div class="section" id="learning-more">
<h2>Learning more<a class="headerlink" href="#learning-more" title="Permalink to this headline">¶</a></h2>
<p>You can find out more about Bazaar in the
<a class="reference external" href="../user-guide/index.html">Bazaar User Guide</a>.</p>
<p>To learn about Bazaar on the command-line:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr help
</pre></div>
</div>
<p>To learn about the &#8216;&#8217;foo&#8217;&#8217; topic or command:</p>
<div class="highlight-python"><div class="highlight"><pre>$ bzr help foo
</pre></div>
</div>
</div>
<div class="section" id="licence">
<h2>Licence<a class="headerlink" href="#licence" title="Permalink to this headline">¶</a></h2>
<p>Copyright 2007-2011 Canonical Ltd. Bazaar is free software, and you
may use, modify and redistribute both Bazaar and this document under
the terms of the GNU General Public License version 2 or later. See
&lt;<a class="reference external" href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</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="#">Bazaar in five minutes</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#installation">Installation</a></li>
<li><a class="reference internal" href="#introducing-yourself">Introducing yourself</a></li>
<li><a class="reference internal" href="#starting-a-new-project">Starting a new project</a></li>
<li><a class="reference internal" href="#adding-files">Adding files</a></li>
<li><a class="reference internal" href="#making-changes-to-your-files">Making changes to your files</a></li>
<li><a class="reference internal" href="#viewing-the-revision-log">Viewing the revision log</a></li>
<li><a class="reference internal" href="#publishing-your-branch-on-launchpad">Publishing your branch on Launchpad</a></li>
<li><a class="reference internal" href="#creating-your-own-copy-of-another-branch">Creating your own copy of another branch</a></li>
<li><a class="reference internal" href="#updating-your-branch-from-the-main-branch">Updating your branch from the main branch</a></li>
<li><a class="reference internal" href="#learning-more">Learning more</a></li>
<li><a class="reference internal" href="#licence">Licence</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../tutorials/index.html"
                        title="previous chapter">Tutorials</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../tutorials/tutorial.html"
                        title="next chapter">Bazaar Tutorial</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/mini-tutorial/index.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="../tutorials/tutorial.html" title="Bazaar Tutorial"
             >next</a></li>
        <li class="right" >
          <a href="../tutorials/index.html" title="Tutorials"
             >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="../tutorials/index.html" >Tutorials</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>