usr
usr

Reputation: 171236

SVN code organization: How to have a filtered branch?

We are using SVN branches to implement our deployment workflow. Development happens in /trunk. When we want to deploy a release, we merge everything into /production. Before /production is deployed the code is reviewed and approved. Goal of the code review is to guarantee that the code is "safe" according to certain criteria.

The SVN has lots of tools, binaries and other files that are required for development (i.e. test code, build tools, ...). They are not required for production, though. It is impossible to review all of those miscellaneous artifacts (especially opaque binaries). On the other hand, nothing that is unreviewed may enter production.

We'd like to have /production be a filtered view of /trunk that only contains whitelisted files and folders. Is there a practical way to have such a filtered branch? Or any other practical way to fulfill the needs of the code review process that we have?

Upvotes: 1

Views: 56

Answers (1)

Slav
Slav

Reputation: 27515

I suggest you read about SVN Externals. As of SVN version 1.6, it is possible to define individual files as svn-externals.

Essentially, it provides you a property list where you can specify what files (and their revisions) are checked out when a certain SVN location is checked out. Usually this is used to add additional files to a checkout, but you can adopt it to check out only specific files that you want to whitelist.

Although internally this is managed through SVN properties, you can import/export these through a text document, which is much easier to maintain. Unfortunately, there is no wildcard filtering of any sort (but you can specify SVN paths, not just individual files), so for your purposes, you would need to list every single file/directory that you want in your "production" branch in this SVN Externals properties file.

Upvotes: 1

Related Questions