Tuesday, August 19, 2008

SVN Branches do HELP


Q: Have you heard about SVN branches ?
A: yes i have

Q: Have you used it before ?
A: no i didn't


if this scenario applies on you, then let me tell you why you should deal with SVN branches. I will try to prove my concept through a small scenario introducing 3 problems you might face while using SVN and how they can be solved with or without branches

Scenario


suppose you are working on a project and after a while you reached a stable state at which you decided to go live. after going live, you decided to move ahead and work on the next version of your project. while working on this version, a sudden problem occurred on your server and your online version was lost.


HOW WILL YOU RETURN IT BACK LIVE AFTER YOU STARTED DEVELOPMENT ON A NEW UNSTABLE VERSION?? This is problem 1.

hopefully you succeeded to do so, but later on, you found a bug and started fixing it but you can't leave your online version containing this bug until you finish development of the new version.


HOW CAN YOU COPY THIS BUG FIX TO THE ONLINE VERSION?? This is problem 2.

you also succeeded doing so, now suppose that problem 1 happened once more but this time after fixing problem 2.


HOW WILL YOU GET BACK ONLINE WHILE NO REVISION CONTAINS BUG FIXES MADE?? This is problem 3.

Without using SVN Branches


In problem 1, you will start looking at the repository revisions searching for the revision number at which you decided to go live in order to check it out again on your server and return online
accepted solution but considering the time and effort you took to do so i consider this solution a difficult one

In problem 2, you will fix the bug then select from your project the altered files and copy them one by one to your server without selecting any other files related to the new version you are working on. this solution will take a lot of time and effort and some errors might be expected while selecting files

In problem 3, i think you will have to work in your weekend in order to find the stable version and add it to bugs fixes that you have made

After SVN Branches


In problem 1, since you have created a new branch for the new version leaving your stable version as it is. all you need is to check it out again.


In problem 2, when you find a bug you will just commit all files you changed to your branch then start fixing that bug and commit the changed files then finally merge the difference between the last two revisions on branch with trunk


In problem 3, take what is in the trunk directly


I think it is now clear how helpful branches can be especially in a project that is expected to change from time to time which is actually common in a large of projects

No comments: