tags:

views:

667

answers:

4

I have a repository of files which are unrelated to each other but are common to multiple projects. Each project might only need a subset of these files. For example:

/myRepo:
    /jquery.js
    /jquery.form.js
    /jquery.ui.js

Project A requires jquery.js and jquery.form.js, whereas Project B requires jquery.js and jquery.ui.js

I could just do a checkout of myRepo into both projects, but that'd add a lot of unnecessary files into both. What I'd like is some sort of way for each Project to only get the files it needs. One way I thought it might be possible is if I put just the required files into each project and then run an svn update on it, but somehow stop SVN from adding new files to each directory. They'd still get the modifications to the existing files, but no unnecessary files would be added.

Is this possible at all?

+1  A: 

If I understood your question correctly, you want to share code across projects? If so, look at the svn:externals property.

Externals explained in Subversion Red Book

svn:externals in Windows

hectorsosajr
no - the issue isn't getting files from external repos, it's getting only certain files from a single repo.
nickf
+3  A: 

Don't complicate yourself. Either pull out all files (what is the disadvatage of this ? a few more 100s of Ks of space ?), or divide the files into several directories, and only check out the needed directories (using the 'externals' property) in relevant projects.

Eli Bendersky
+1  A: 

K, this isn't perfect, but it will do. The biggest problem is that it will update each file individually:

find . -print | grep -v '\.svn' | xargs svn update

I am sure that someone with more find mojo can figure out a better way of handling the svn directory exclusion.

Jonathan Arkell
yeah, that's more along the lines of what I was after. Is it possible to give SVN a list of files to update at once, rather than one by one?
nickf
I did a quick check in the SVN update options, and didn't see anything.
Jonathan Arkell
+1  A: 

In our company we store all projects in the same repository, but within their own project folder. Then if code needs to be shared we move it out to a library folder. This helps reusability, and not violating the DRY principle.

So as far as the server is concerned you can export all of your libraries to a central place, and your projects wherever, without overlapping.

J.J.
mmm yes, but i'm talking more about individual files which wouldn't warrant their own folders (like the jquery files given in the example).
nickf