The subversion concept of branching appears to be focused on creating an [un]stable fork of the entire repository on which to do development. Is there a mechanism for creating branches of individual files?
For a use case, think of a common header (*.h) file that has multiple platform-specific source (*.c) implementations. This type of branch is a permanent one. All of these branches would see ongoing development with occasional cross-branch merging. This is in sharp contrast to unstable development/stable release branches which generally have a finite lifespan.
I do not want to branch the entire repository (cheap or not) as it would create an unreasonable amount of maintenance to continuously merge between the trunk and all the branches. At present I’m using ClearCase, which has a different concept of branching that makes this easy. I’ve been asked to consider transitioning to SVN but this paradigm difference is important. I’m much more concerned about being able to easily create alternate versions for individual files than about things like cutting a stable release branch.
Sadly, I think the real answer here is that ClearCase handles this situation a lot better than Subversion. With subversion, you have to branch everything, but ClearCase allows a kind of ‘lazy branch’ idea that means only a certain group of files are branched, the rest of them still follow the trunk (or whichever branch you specify).
The other solutions provided here don’t really work as you intend, they are just copying the file to a different path. Now you have to do odd things to actually use that file.
Erm, sorry. That wasn’t really a very good answer. But there isn’t a good solution to this with Subversion. Its model is branch and merge.
Edit: OK, so expanding on what crashmstr said. You could do this:
But wow!, is that prone to errors. Whenever you do a svn st you will see this:
A bit noisy that. And when you want to branch a few files or modules within a large source repository it will start to get very messy.
Actually, there’s probably a decent project in here for simulating something like ClearCase’s branched files with svn properties and switching, writing a wrapper around the bog standard svn client to deal with all the mess.