Enjoyable version control with the Tortoise

Update, merge, test, add, update, commit… that’s what I do when working in a communal software project. Update, merge, test, add, update, commit…
So I’ve written some additional tests for JUMBO. Now I have to save them and share them with my collaborators (anyone who wants to collaborate). When I look at my directory on Windows it looks like:
tortoise1.png
As you can see some of the files are green and some are orange. The orange ones are those I have changed since “last time”. Last time of what? last time I used the Tortoise,:
tortoise.png
tortoise.png
This cheerful fellow (developed initially by Francis – who I first met on the Cambridge geek puntconvention – maybe more later) sits on top of CVS. Now CVS is a wonderful tool – about 15 years old, I thnk – which manages the versions of your documents. You (or someone else) sets up a CVS server and every so often you chek your current files against the server. It tells you when they are out of synce and whether you need to upload a file TO the server or download someone else’s update FROM the server. (Remember we work as collaborators!).
CVS is a great concept but pretty hairy for normal mortals, with some fairly esoteric runes to remember. It’s sufficiently forbidding almost to scare you away. Tortoise makes it trivially easy by adding itself to your normal file browser. All you do is right-click and follow simple commands.
The first is Update. Has anyone changed the files on the server since I last used CVS? If so it will download them to my directory and merge them. (Don’t worry about being overwritten, CVS remembers all versions). Update also tells me which files I have edited.
tortoise2.png
(The pink ones are new). Since there were one or two serverside changes I now have to re-test the system (the changes might break my code). In this case the test passes. Sometimes it requires a lot of work to merge the changes – that’s normally a good thing because someone else is working with you. Now let’s re-update in case the server has changed. No? Did I create any new files? I check with “Add contents” – yes, I did. (This is where I most frequently goof up – unless I send these files to the server my collaborators won’t see them. And their systems will then fail). So I add the files, and then “Commit”.
Now everyone in the project can update from my latest changes…
Some of you will have thought “what happens if two people make changes to the same file at the same time?” CVS will try to merge the changes. If they are in different parts of the file it’s probably OK. If not there will be a conflict. This is a bit of a pain, and normally involves reverting to the older version and then agreeing between the two people what changes each wanted to make and why. In many projects – such as CDK – the active developers keep a chat room open so they can send messages like “I need to change X – does anyone mind?” Much better than technical mechanisms.
Here’s the final commit:
tortoise3.png
CVS is now being superseded by Subversion (SVN) which is even easier (and also has a Tortoise overlay). We use SVN locally, but I haven’t got a round to changing it at SourceForge for JUMBO…
CVS or SVN is also very good for dealing with other documents (if they are in ASCII). Take a look. You’ll find you are working in a community, not alone…
(Oh – and why am I using Windows? Don’t ask)

This entry was posted in programming for scientists. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *