Recent Subversion versions allow to specify the maximum depth to use when updating a given target. You can e.g. specify that you only want the files in a given directory, but not its sub-directories. Or you want a given directory to be empty, or removed from the working copy entirely.
Let's consider you've checked out an entire working copy, with the following structure:
root
dir1
file1.1
file1.2
subdir1.1
subdir1.2
subdir1.3
subdir1.4
dir2
file2.1
subdir2.1
file2.1.1
dir3
file3.1
dir3.1
If you're not interested anymore in subdir2.1 and its content, you can issue the following commands:
> cd root/dir2
> svn update --set-depth exclude subdir2.1
Now dir2 only has file2.1, and an 'svn update' command that does not specify a '--set-depth' option will not bring back subdir2.1 or any of its content.
If you're only interested in the files inside dir1, but not the subdir1.*, you could do:
> cd root
> svn update --set-depth files dir1
This tells SVN to only get the files in dir1, but not its sub-directories
Similarly, you can use '--set-depth empty' to get an empty directory (this can be useful to ask for one of its sub-directories), '--set-depth immediates' to get the immediate sub-directories, and use '--set-depth infinity' to restore the default and get everything in a given directory.
On the reverse, if you have to checkout a working copy but you know you only need some parts of it, you can use the '--depth' option (not '--set-depth', go figure...) of the checkout command. Then you create your paths in your working copy, step by step:
> svn checkout --depth empty [repository URL] root
> svn update --set-depth empty root/dir1
> svn update --set-depth infinity root/dir1/subdir1.2
> svn update --set-depth infinity root/dir3
Hope this helps!
Sweet! My life has just gotten better. thx.
ReplyDelete