Mike
Mike

Reputation: 3575

svnant: How to checkout specified URLs from a repository?

Hi all: i'm using SVNant to checkout a repository, the total repository content is so large and i'm only interest in a few file and directories, the repository structure as below:

project
   folder1
   folder2
      largefolder
          largefile1
          largefile2
      folder3
          fileilike1.txt
          fileilike2.txt
   file.txt
   file2.txt
   etc...

i'm only interest in the files under project/ folder such as file.txt and file2.txt, and also all files under folder3. i do not want to checkout largefolder/ because it has extra-large files in it.

how to write the svnant script? i use ignore but seems not work.

Upvotes: 2

Views: 618

Answers (3)

David W.
David W.

Reputation: 107080

You can use a combination of various depths to select what you want in your working directory:

#
# First checkout your URL with the immediate files and directories in it
#
$ svn co --depth immediates $URL mydir
A folder1
A folder2
A file.txt
A file2.txt

#
# Let's Update All Folders to infinity except folder2
#
$ shopt -s extglob
$ svn update --set-depth infinity !(folder2)
A folder1/...
A folder3/...
$ cd mydir

#
# Now We'll get immediates under folder2
#
$ cd folder2
$ svn update --set-depth immediates
A largefolder
A folder3

#
# Now we'll exclude largefolder
#
$ svn update --set-depth exclude largefolder
D largefolder

#
# And get everything else in the view
#
$ svn update --set-depth infinity *  # Large Folder Excluded
A [...]
$ cd ..

The --depth and --set-depth switches are fairly new and replace the -N switch which stops recursion.

Instead of keeping largefolder, you could simply keep largefolder around and simply do svn update <file> for particular files you may need to update. Once something is in your working directory, the svn up will keep it updated. However, you have to be careful because unless you do a svn up --set-depth, new files and directories won't be added.

Upvotes: 0

thekbb
thekbb

Reputation: 7924

If you're checkout has to be this complicated, perhaps you can rework the project structure. Are these in fact multiple projects? I hope you have branches, tags and trunk folders in the layout but chose not to list them for brevity?

Upvotes: 1

Vikram.exe
Vikram.exe

Reputation: 4585

I haven't used 'svnant' but I think it should be similar to 'svn'

Here is how you can do this in svn

svn co project -N

-N forces to check out only the top level files (ie files in project directory only)

then check out individual directory

svn up dir1 dir2 dir3

When you want to update codebase, do it in two steps

svn up -N
svn up

Although you can configure to avoid step 1 mentioned above while updating, but the above should work perfectly fine for you.

Upvotes: 0

Related Questions