Tagging part of a repository in subversion

cvssvn

I come from a CVS background. I'm currently investigating using SVN for a project. The code that I work on tends to be in the following directory structure.

project\libs\lib1

project\libs\lib1\test

project\libs\lib1\mock

project\libs\lib2

etc.

When I tag a release, in CVS, I tend to create two tags one being "project-release-1" and one being "project-release-1-with-tests". The "project-release-1" tag excludes the test directories and mock directories and possibly some other files. The idea being that we often don't ship our test source to clients and by doing an export of the "project-release-1" tag we get a client's set of source that we can ship to them and by doing a checkout on the "project-release-1-with-tests" tag we get the whole lot that we can use for branching if need be for ongoing development.

How do I do something similar with SVN? Ideally in a form that can be scriptable; with SVN we have a script per project which will apply both tags and create the client tag by simply removing the tag from the test and mock directories, etc…

I'm guessing that in SVN I'd create the "with tests" tag, then (somehow) check that out, delete the test and mock directories and create the client release tag?

Update:

I've decided to change how I do things… Rather than having a script per project that sets up my old style twin tags I now have a script per project that takes the tagged release (which includes the stuff that I don't ship to clients) and removes the stuff that I don't ship to clients. Job done, only one tag needed.

Best Answer

I don't know if this is the "correct" answer, but I can think of two options.

A. Tag and delete:

  1. Tag your /project/libs directory as project-release-1;
  2. Delete "test" and "mock" directories from project-release-1. Alternatively, first create a project-release-1-with-tests tag with everything, then tag (copy) that directory as project-release-1 and repeat #2 above.

B. Use "externals":

  1. Create an empty project-release-1 directory under tags. Don't really tag, just create the directory.
  2. Edit the properties of that directory, add a property named "svn:externals". In that property's value enter: lib1 -r $REV url:to/project/libs/lib1 lib2 -r $REV url:to/project/libs/lib2

where $REV is the revision number of the tagged source code. Later when you'll check out the "without tests" directory you'll get the two "tagged" directories.

I believe the first option is better, as tools that analyze branches and tags will have a better change of understanding what you did.

On a side note, I wonder why you'd want the test-less tag; Why does it bother you that you have the tests in the tag?

  • Noam.