Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6d417e36f6bb1154f4c003e6717e298 > files > 166

a-a-p-1.090-2mdv2009.0.noarch.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 18. Version Control</title><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="A-A-P Recipe Executive"><link rel="up" href="user.html" title="Part II. User Manual"><link rel="prev" href="user-install.html" title="Chapter 17. Installing"><link rel="next" href="user-cvs.html" title="Chapter 19. Using CVS"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table width="100%" id="navtable"><tbody><tr><td align="left" class="left" width="33%"><b><a href="http://www.a-a-p.org">A-A-P home page</a></b></td><td align="center" class="center" width="34%"><b><a href="index.html">A-A-P Recipe Executive</a></b></td><td align="right" class="right" width="33%"></td></tr><tr><td align="left" class="left"><a accesskey="p" href="user-install.html">Prev</a></td><td align="center" class="center">User Manual</td><td align="right" class="right"><a accesskey="n" href="user-cvs.html">Next</a></td></tr></tbody></table><hr><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="user-version"></a>Chapter 18. Version Control</h2></div></div></div><p>
This is about using <span class="application">Aap</span> with a Version Control System (VCS)
</p><p>
The generic form of version control commands is:
</p><pre class="programlisting">
        :command file ...
</pre><p>
Or:
</p><pre class="programlisting">
        :command {attr = val} ... file ...
</pre><p>
</p><p>
The commands use the "commit" attribute of a file to obtain the kind of
version control system and its location.  For example:
</p><pre class="programlisting">
        :attr foo.c {commit = cvs://:ext:$CVSUSER_AAP@cvs.a-a-p.sf.net:/cvsroot/a-a-p}
</pre><p>
For CVS it is also possible to only specify the method.  CVS will then use the
same specification for the repository as used when checking the files out.
</p><pre class="programlisting">
        :attr foo.c {commit = cvs://}
</pre><p>
</p><p>
These commands can be used:
</p><div class="informaltable"><table border="0"><colgroup><col width="100"><col></colgroup><tbody><tr><td><a href="ref-commands.html#cmd-commit">:commit</a></td><td>Update each file in the repository.  Add it when needed.</td></tr><tr><td><a href="ref-commands.html#cmd-checkout">:checkout</a></td><td>Like fetch and additionally lock for editing when possible.</td></tr><tr><td><a href="ref-commands.html#cmd-checkin">:checkin</a></td><td>Like commit, but unlock file.</td></tr><tr><td><a href="ref-commands.html#cmd-unlock">:unlock</a></td><td>Remove lock on file, don't change file in repository or
    locally.</td></tr><tr><td><a href="ref-commands.html#cmd-add">:add</a></td><td>Add file to repository.  File must exist locally.  Implies a
    "commit" of the file.</td></tr><tr><td><a href="ref-commands.html#cmd-remove">:remove</a></td><td>Remove file from repository.  File may exist locally.  Implies a
    "commit" of the file.</td></tr><tr><td><a href="ref-commands.html#cmd-tag">:tag</a></td><td>Add a tag to the current version.  Uses the "tag"
    attribute.</td></tr></tbody></table></div><p>
</p><p>
Additionally, there is the generic command:
</p><pre class="programlisting">
        <a href="ref-commands.html#cmd-verscont">:verscont</a> action {attr = val} ... file ...
</pre><p>
This calls the Version control module as specified in the "commit" attribute
for "action" with the supplied arguments.  What happens is specific for the
VCS.
</p><h2><a name="id2647376"></a>Operating On All Files</h2><p>
These commands work on all the files mentioned in the recipe and child
recipes that have the "commit" attribute:
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col width="120"><col></colgroup><tbody><tr><td><a href="ref-commands.html#cmd-checkoutall">:checkoutall</a></td><td>Checkout the files and locks them.</td></tr><tr><td><a href="ref-commands.html#cmd-commitall">:commitall</a></td><td> Commit the files .  Files missing in the VCS will be added.  No
    files will be removed.</td></tr><tr><td><a href="ref-commands.html#cmd-checkinall">:checkinall</a></td><td>Just like :commitall and also remove any locks.</td></tr><tr><td><a href="ref-commands.html#cmd-unlockall">:unlockall</a></td><td>Unlock the files.</td></tr><tr><td><a href="ref-commands.html#cmd-addall">:addall</a></td><td>Inspect directories and add items that do not exist in the VCS
                but are mentioned in the recipe(s) with a "commit" attribute.
                Uses the current directory or specified directories.
                May enter directories recursively.</td></tr><tr><td><a href="ref-commands.html#cmd-removeall">:removeall</a></td><td>Inspect directories and remove items that do exist in the VCS
                but are not mentioned or do not have a "commit" attribute.
                Careful: Only use this command when it is certain that all
                files that should be in the VCS are explicitly mentioned and
                do have a "commit" attribute!</td></tr><tr><td><a href="ref-commands.html#cmd-reviseall">:reviseall</a></td><td>Just like using both <code class="literal">:checkinall</code> and
                <code class="literal">:removeall</code>.</td></tr><tr><td><a href="ref-commands.html#cmd-tagall">:tagall</a></td><td>Add a tag to all items with a "commit" and "tag"
                attribute.</td></tr></tbody></table></div><p>
</p><p>
Related to these commands are targets that are handled automatically when not
defined explicitly.  When defining a target for these, it would be highly
unexpected if it works differently.
</p><p>
</p><div class="informaltable"><table border="0"><colgroup><col width="120"><col></colgroup><tbody><tr><td><strong class="userinput"><code>aap commit</code></strong></td><td> Normally uses the files you currently have to update the
                version control system.  This can be used after you are done
                making a change.  Default is using
                <a href="ref-commands.html#cmd-commitall">:commitall</a>.</td></tr><tr><td><strong class="userinput"><code>aap checkout</code></strong></td><td> Update all files from the VCS that have a "commit" attribute.
                When the VCS supports locking all files will be locked.
                Without locking this does the same as "aap fetch".</td></tr><tr><td><strong class="userinput"><code>aap checkin</code></strong></td><td> Do
      <a href="ref-commands.html#cmd-checkin">:checkin</a> for all files that have been checked out of the
                VCS.  For a VCS that doesn't do file locking this is the same
                as "aap commit".</td></tr><tr><td><strong class="userinput"><code>aap unlock</code></strong></td><td> Unlock all files that are locked in the VCS.  Doesn't change
                any files in the VCS or locally.</td></tr><tr><td><strong class="userinput"><code>aap add</code></strong></td><td> Do
      <a href="ref-commands.html#cmd-add">:add</a> for all files that appear in the recipe with a
                "commit" attribute that do not appear in the VCS.</td></tr><tr><td><strong class="userinput"><code>aap remove</code></strong></td><td> Do 
      <a href="ref-commands.html#cmd-removeall">:removeall</a>: remove all files that
      appear in the VCS but
                do not exist in the recipe with a "commit" attribute or do not
                exist in the local directory.  This works in the current
                directory and recursively enters all subdirectories.
                Careful: files with a search path may be accidentally
                removed!</td></tr><tr><td><strong class="userinput"><code>aap tag</code></strong></td><td> Do
      <a href="ref-commands.html#cmd-tagall">:tagall</a>: tag all files with a "commit"
      and "tag"
                attribute.  The tag name should be defined properly in the
                recipe, although "aap tag TAG=name" can be used if the recipe
                contains something like:
                        <code class="literal">:attr {tag = $TAG} $FILES</code></td></tr><tr><td><strong class="userinput"><code>aap revise</code></strong></td><td> Same as "aap checkin" followed by "aap remove": checkin all
                changed files, unlock all files and remove files that don't
                have the "commit" attribute.</td></tr></tbody></table></div><p>
</p><p>
For the above the "-l" or "--local" command line option can be used to
restrict the operation to the directory of the recipe and not recurse into
subdirectories.
</p><p>
A variable can be used to set the default change log entries:
</p><pre class="programlisting">
    LOGENTRY=message
</pre><p>
This variable is used for new, changed and deleted files that don't have a
{logentry} attribute.
</p><p>
When it's desired to commit one directory at a time the following construct
can be used:
</p><pre class="programlisting">
        source_files = *.c
        include_files = include/*.h
        commit-src {virtual}:
            :commit $source_files
            :removeall .
        commit-include {virtual}:
            :commit $include_files
            :removeall include
</pre><p>
Note that this is not possible when the sources and include files are in one
directory,
<a href="ref-commands.html#cmd-removeall">:removeall</a> only works per directory.
</p><h2><a name="id2647843"></a>Using Subversion</h2><p>
Subversion is a new version control system that is going to replace CVS.
It has many advantages, such as atomic commits.  But version 1.0 is not ready
yet (although the current versions appear to be very stable and usable).
</p><p>
Subversion support is not implemented yet.  For the time being you can
retrieve files from a Subversion repository by using a URL.  That works,
because subversion is using an Apache server.  You can obtain a copy of single
files by specifying the URL in the fetch attribute.  Obviously you can't
commit changed files this way.
</p><h2><a name="id2647852"></a>Using Another Version Control System</h2><p>
To add support for a new version control system, define a Python function with
the name "method_command", where "method" is the word at the start of the
commit attribute.
The function will be called with five arguments:
</p><div class="informaltable"><table border="0"><colgroup><col width="100"><col></colgroup><tbody><tr><td>recdict</td><td>a dictionary with references to all variable scopes (for expert
        users only)</td></tr><tr><td>name</td><td>the name of the repository defined with the "commit" attribute
          with the "scheme://" part removed.</td></tr><tr><td>commit_dict</td><td>the dictionary holding attributes for the specified repository;
          e.g., for "{commit = foo:// {arg = blah}}" it is (in Python syntax):
          { "name" : "foo://", "arg" : "blah" }</td></tr><tr><td>nodelist</td><td>a list of the nodes on which the action is to be
          performed</td></tr><tr><td>action</td><td>the name of the action to be executed; can be "fetch",
          "commit", etc.</td></tr></tbody></table></div><p>

The function should a list of nodes that failed.  When the action worked
without errors an empty list should be returned.
</p><p>
  For an example look at cvs_command() in the VersContCvs.py file of the <span class="application">Aap</span>
  sources.
</p><p>
  A second function that is to be defined is "method_list".  
  It should return a list of the files that are currently in a specified
  directory in the repository.  Return an empty list if there are no files.
  The function will be called with these arguments:
</p><div class="informaltable"><table border="0"><colgroup><col width="100"><col></colgroup><tbody><tr><td>recdict</td><td>a dictionary with references to all variable scopes (for expert
        users only)</td></tr><tr><td>name</td><td>the name of the repository defined with the "commit" attribute
          with the "scheme://" part removed.</td></tr><tr><td>commit_dict</td><td>the dictionary holding attributes for the specified repository;
          e.g., for "{commit = foo:// {arg = blah}}" it is (in Python syntax):
          { "name" : "foo://", "arg" : "blah" }</td></tr><tr><td>dirname</td><td>name of the directory to be listed</td></tr><tr><td>recursive</td><td>boolean indicating whether recursive listing is to be
          done</td></tr></tbody></table></div><p>
</p><p>
  For an example look at cvs_list() in the VersContCvs.py file of the <span class="application">Aap</span>
  sources.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="user-install.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="user.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="user-cvs.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 17. Installing </td><td width="20%" align="center"><a accesskey="h" href="index.html">
		    Contents</a></td><td width="40%" align="right" valign="top"> Chapter 19. Using CVS</td></tr></table></div></body></html>