Skip directory in SVN checkout? (Partial checkout)

Kerrek SB picture Kerrek SB · Dec 12, 2011 · Viewed 18.3k times · Source

Suppose a remote SVN repository has this structure:

/project
        /src
        /bulk

Now for some reason I already have a copy of bulk (assumed unchanging or rarely changing) elsewhere on my machine. Can I somehow checkout a new copy of the repository, but pre-provide the bulk directory so it doesn't get downloaded again?

To clarify, this hypothetical process should certainly check the checksums on the files in the bulk directory and update those files which aren't correct, so that ultimately I'll have a complete, consistent checkout. I just want to shortcut past downloading those files which I already have verbatim.

Answer

Adam Ralph picture Adam Ralph · Dec 12, 2011
  1. Checkout /project, specifying the depth to be 'empty'.
  2. Update /project/src specifying infinite depth.
  3. Copy your current bulk working copy into the project directory working copy.

e.g.

svn checkout --depth empty http://svnserver/project/ project
svn update --set-depth infinity project/src
// copy your current /bulk into /project

Note - this takes advantage of the sparse directories feature introduced in Subversion 1.5.