Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 0b38be552745286620faf2138b9468d0 > files > 39

subversion-doc-1.4.6-5.1mdv2008.1.x86_64.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>Sparse Directories</title><link rel="stylesheet" href="styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Version Control with Subversion" /><link rel="up" href="svn.advanced.html" title="Chapter 3. Advanced Topics" /><link rel="prev" href="svn.advanced.props.special.keywords.html" title="Keyword Substitution" /><link rel="next" href="svn.advanced.locking.html" title="Locking" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Sparse Directories</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="svn.advanced.props.special.keywords.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Advanced Topics</th><td width="20%" align="right"> <a accesskey="n" href="svn.advanced.locking.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="svn.advanced.sparsedirs"></a>Sparse Directories</h2></div></div></div><p>By default, Subversion commands on directories act in a
      recursive manner.  For example, <span class="command"><strong>svn checkout</strong></span>
      creates a working copy with every file and directory in the
      specified area of the repository, descending recursively through
      the repository tree until the entire structure is copied to your
      local disk.  Subversion 1.5 introduces the
      <code class="option">--depth</code> option which allows you to easily
      checkout all or part working copy with the freedom to bring in
      previously ignored files subdirectories at anytime.  For
      example, say we have a repository with the following
      structure:</p><pre class="screen">
$ svn co file:///var/svn/repos mom
A    mom/son
A    mom/son/grandson
A    mom/daughter
A    mom/daughter/granddaughter1
A    mom/daughter/granddaughter2
A    mom/daughter/fishie.txt
A    mom/kitty1.txt
A    mom/doggie1.txt
Checked out revision 1.
</pre><p>Now, let's checkout the same tree with, but with no children
      at all:</p><pre class="screen">
$ svn co file:///var/svn/repos mom --depth=empty
Checked out revision 1
</pre><p>Now let's dig a little deeper and checkout the tree with
      only the files in the top-level directory:</p><pre class="screen">
svn co file:///var/svn/repos mom --depth=files
A    mom/kitty1.txt
A    mom/doggie1.txt
Checked out revision 1.
</pre><p>As you can see, we got only the files in the top-level
      directory, and not the directories.  If we want the files and
      directories in the top-level directory, but not the children in
      those directories, we can use the immediates argument:</p><pre class="screen">
svn co file:///var/svn/repos mom --depth=immediates
A    mom/son
A    mom/daughter
A    mom/kitty1.txt
A    mom/doggie1.txt
Checked out revision 1.
</pre><p>This retrieves the subdirectories in the top-level, but sets
      the depth of each of these subdirectories to empty.</p><p>While we've used svn checkout as an example here, you can
      use the <code class="option">--depth</code> option with many other
      Subversion commands.  Here's a brief overview of what each depth
      argument does (See <a class="xref" href="svn.ref.html" title="Chapter 9. Subversion Complete Reference">Chapter 9, <i>Subversion Complete Reference</i></a> for details on
      which commands use the <code class="option">--depth</code> option).</p><div class="variablelist"><dl><dt><span class="term"><code class="literal">--depth=empty</code></span></dt><dd><p>Include only files or subdirectories that are already
            in your working copy (which means none if you're doing a
            fresh checkout).</p></dd><dt><span class="term"><code class="literal">--depth=files</code></span></dt><dd><p>Increase the depth of the current directory to include
            files, but not subdirectores</p></dd><dt><span class="term"><code class="literal">--depth=immediates</code></span></dt><dd><p>Increase the depth of the current directory to include
            both subdirectories with <code class="option">--depth=empty</code>
            and files.</p></dd><dt><span class="term"><code class="literal">--depth=infinity</code></span></dt><dd><p>The default behavior.  Increases the depth of the
            current directory to, well, infinity (what indeed did you
            expect?)</p></dd></dl></div><p>To illustrate how you might use sparse directorise, let's
      say that you have a repository with 37 top-level
      projects:</p><pre class="screen">
trunk/project1
trunk/project2
trunk/project3
...
trunk/project36
trunk/project37
</pre><p>If you're working on <code class="literal">project23</code> and it has
      dependencies on <code class="literal">project14</code> and
      <code class="literal">project29</code>, it would be convenient to checkout
      those three projects as part of a cohesive working copy without
      sucking down the other 34 projects.  To do this, you could
      perform the following series of actions:</p><pre class="screen">
$ svn checkout file:///var/svn/repos/trunk uberproject --depth=empty
...
$ cd uberproject
$ svn update project14
...
$ svn update project23
...
$ svn update project29
...
</pre><p>Now you have a minimally-sized working copy that will allow
      you to commit changes to all three of these projects at
      once.</p><p>Another time where sparse directories are useful is when
      you've just done a merge into your working copy and you'd like
      to see the property modifications that will be recorded as part
      of the merge, running svn diff on your directory will pull down
      all the changes in your working copy recursively, however, if
      you use <code class="option">--depth=empty</code>, it will only show the
      property modifications (i.e. only the changed mergeinfo) on the
      root directory of your working copy.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="svn.advanced.props.special.keywords.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="svn.advanced.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="svn.advanced.locking.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Keyword Substitution </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Locking</td></tr></table></div></body></html>