Search This Blog

Tuesday, February 16, 2010

How to structure your repository in SVN

I read a article on subversion architecture just thought of sharing with you (http://ariejan.net/2006/11/24/svn-how-to-structure-your-repository/), I have tailored this article to be easy to learn if you want the full article please check out the link given above


Subversion repository are three directories: branches, tags and trunk.
Each directory in subversion can be checked out separately.
Trunk

The trunk contains the most current development code at all times. This is where you work up to your next major release of code.
The trunk should only be used to develop code that will be your next major release. Don’t brand the trunk with version numbers or release names. Just keep the trunk in “development mode” at all times.
Example:
https://svn.example.com/svnroot/project/trunk

Branches

There are different types of branches.
With the branches directory you can create paths for you code to travel to more specific goals like an upcoming release.Subversion the branches directory contains copies of your trunk at various stages of development.

Release Branches

We have already seen the RB-x.x release branches. When the trunk reaches the stage that it’s ready to be released (or when you want to freeze the addition of new features) you create a release branch.

This release branch is just a copy of your current trunk code.

https://svn.example.com/svnroot/project/branches/RB-1.0

Bug fix branches

Branches may also be used to address the more serious bugs found in the trunk or a release branch. The bugs are of such a magnitute that you can’t fix them by yourself in a single commit. So, in order to focus on the problem of fixing this bug you should create a new branch for this purpose. This allows development in the trunk or your release branch to continue, and you won’t disturb them with new bugs or tests that break the current code.

Bug fix branches are named after the ID they are assigned in your bugtracking tool. Mostly this is a number: BUG-3391

https://svn.example.com/svnroot/project/branches/BUG-3391


Experimental branches

Something that also happens a lot is the introduction of new technologies. This is fine, of course, but you don’t want to bet your entire project on it.
Imagine that you want to change from PHP 4 to PHP 5 for your web application. How long would it take you to convert your entire project? Do you want your entire code base (trunk) to be useless until you have converted all of your code? Probably not!

Experimental branches may be abandonned when the experiment fails. If they succeed you can easily merge that branch with the trunk and deliver your big new technology. These branches are named after what you’re experimenting with.

https://svn.example.com/svnroot/project/branches/TRY-new-technology

Tags

Tags are, like branches, copies of your code. Tags, however, are not to be used for active development. They mark (tag) a certain state your code is in.

Release tags

Release tags mark the release (and state) of your code at that release point. Release tags are always copies of the corresponding release branch. Release tags are prefixed with ‘REL-’ followed by a version number.


https://svn.example.com/svnroot/project/tags/REL-1.0.0

No comments:

Post a Comment