waterwaterwaterwaterwaterwaterwaterwaterwaterwaterPollenation web design
09/05/2004

SVN and Tortoise

cats:

    One of the things I learnt quickly when working with computers is that an undo feature is quite handy. The amount of times you added or deleted something you didn't mean to is embarrassingly large. An undo feature is now included on most programs and I'm sure a lot of people wish they also came as a birth right(I know I'm spent many times wishing for one). One things most programs don't allow you to do is to undo past the point where started each session. Version control systems allow you to 'undo' back to any saved file and are a lifesaver in many situations. You don't even need to limit their use to programming, we have everything we do version controlled from designs through invoices and contact lists to letters to clients. One of the great things source control systems also allow you to do is to work on 'branches' and to apply the changes back into the main code (or trunk) all in one go. This helps in.. er... well... ... imagine the situation where a client has some a website that you've built and it's all working niceley. You are in the process of testing a new shopping basket system for them and, quite rightly, have a beta site on which to demonstrate it. Because you are quite cautious, you have your source code locally and are making some fixes to the beta upgrade. You now have three copies of the site code, which is fine because you just overwrite your changes when you upload. However, the client says they need to support a new credit card type NOW!! You now have to make changes to the live code (or a copy of it) and set up a new beta site to test and then reapply all the changes to the code that you have been working on. PAIN!! With a source control system, you can keep multiple copies of the site in different states AND apply the same change to multiple versions. So you add the new credit card change and then apply it to the live site and the upgrade site, knowing that you can jump back to the previous version if anything goes wrong. (other websites explain branches and changesets and tagging very well). Some of the predominant version control systems are Microsoft Visual Source Safe and CVS. Visual Source Safe has some dependancies (apart from Microsoft Windows) and also has some limitations and alleged dangers (Microsoft's Source Destruction System) that I don't want to get into and most of my previous experience has been with CVS. CVS was great. It performed well, did most of the things we wanted to do with it and saved our bacon many times. It also had some problems however (mainly lack of binary file support and the fact that directory manipulation was terrifying) and it was unsurprising when a team of developers (Collabnet Inc) began building a newer, shinier version. The result, SVN, was like CVS but fixed. SVN played nice. Making big changes using SVN didn't scare the pants off me. In short, SVN is quite cool. What can make SVN go from really cool to killer general application is Tortoise SVN (This is windows only and unfortunately I haven't found a linux equivalent but most linux users will just use the command line. right?). Tortoise SVN integrates with the windows explorer shell which means that you get right click menu options for checking things in and out and little icons on the files to show what has been changed and needs commiting to the server. Tortoise SVN is so simple that, if you get it set up for them, even your boss could use it. Here's a screenshot of a typical windows explorer window. .. image:: /assets/images/journal/tortoise- svn-explorer.gif

    System Message: ERROR/3 (<string>, line 49)

    Unexpected indentation.
    alt:An example of Tortoise SVN in use

    System Message: WARNING/2 (<string>, line 50)

    Block quote ends without a blank line; unexpected unindent.

    You don't even need an SVN server set up as it can install a local copy. Give it a try, it might seem like a little extra hassle to begin with but it's a bit like backing up, when you need it, you really, really need it!!