How Subversion Can Solve Your Development Nightmares – Part 1 of 3
Imagine this…
You’ve just spent several hours upgrading your client’s store. Everything looks great on your test server, so you push the changes live.
Firing up a browser, you visit the client’s live store to marvel at your work, only to be presented with a series of error messages.
Uh oh.
The store is broken, your client is losing sales, and you’ve got no idea how long it’s going to take to fix. What do you do?
If the problem cannot be solved quickly, then there is only one option. Get rid of your new changes by uploading the previous versions of changed files.
Being the pro that your are, you obviously made a backup of them before you did the upgrade. You DID make a backup didn’t you?
Subversion to the rescue
This 3 part tutorial series will introduce you to Subversion and TortoiseSVN, open source revision control software programs that speed up and organise the development process. They are ideal to prevent situations like the one above happening.
An introduction to Subversion
A few years ago, CVS, the most popular revision control software at the time, was replaced by Subversion (SVN). Subversion does everything CVS does and more.

Subversion works by monitoring changes to code over time. Every change you make to a file is stored with a time and revision number. The beauty of this system is that if you find a fault in one of your files, you can revert that file to any of its previous states.
It also allows multiple developers to work on the same piece of software, without interfering with each other. When development is complete, the sets of code can be automatically merged together.
Unfortuately, Subversion requires you to type commands into a terminal window in order to make it do stuff. If you’re new revision control software then this is not a good way to learn.
That’s why TortoiseSVN was invented.
TortoiseSVN – A Windows shell extension for Subversion
TortoiseSVN is an additional program that allows you to access the power of Subversion from Windows Explorer. It is easy to understand and is great for those people who prefer graphical user interfaces.
Having spent several years using Subversion from the command line, I now use TortoiseSVN exclusively. It’s that good.
How Subversion works
Think of a tree. The trunk is the main part of the tree which grows upwards. As the years go by, the trunk gets longer as new cells are added to the top.
The Trunk
This is exactly the same in Subversion. The trunk is the main path of your project. Whenever a file is added or updated, a new revision (R1, R2, etc.) of the project is created. At any time you have access to any of the previous revisions.

Branches
At any stage, a branch can be created which splits off the trunk. It allows someone to work on the project without harming the trunk. In the real world, you might create a branch for each developer, a new feature you want to add or for each of your clients. That way, a change you make for one client won’t affect all the other clients.
In the diagram below, a branch has been created at revision 3, then the code modified and saved to create revision 4. Meanwhile another developer has continued to make changes to the trunk to create revision 5. Both developers are working in parallel without affecting each other.

Merging
When the time comes, the branch can be merged back into the trunk to create R6 which will contain the changes made in R5 and the changes made in R4.

Conclusion
Now you should now a little more about Subversion, TortoiseSVN and why you should be using it.
In part two of this three part series, you will get some hands-on experience using Subversion on a mini project as we walkthrough some common use cases.
Enjoyed reading this post? Get more delivered directly to you.
Responses
Reply