GENIE Quick SVN ref

=What is Subversion?=

Subversion (abbreviated to SVN) is the successor to CVS. It is closely related to CVS and so many of the commands are the same. Subversion still has the commands checkout, commit and update, except that, for example, cvs update is replaced with svn update. Happily this means that there is little re-learning required to use SVN instead of CVS. If CVS and SVN were entirely alike, we would not get the advantages that Subversion brings. Subversion addresses a number of the shortcomings of CVS. For example, the command svn move now exists, which allows you to rename a file without losing it's history, something not possible under CVS.

=Using Subversion=

First, just as it was with CVS, you will need a Subversion client installed on your machine. If you are using linux, then you will most likely have the command line client already installed. Try typing "which svn" to see if the clent is in your path. Command line and nice GUI clients for SVN are available for just about any operating system. tortoisesvn is popular for windows. SVNx is a good choice for the Mac. For more links see the links page on this wiki.

Once you have Subversion installed, you will need a username and password. If you haven't already them, email Gethin. You can get read-only access to the code by using the username "genie-user" and the password you would expect. Happily, access is considerably easier than for CVS. You will be prompted for your password when required. SVN caches your password, and so you often do not need to type it.

Another big difference between CVS and SVN is that repositories are accessed through a URL. For example, you can checkout GENIE from SVN by typing: svn checkout http://source.ggy.bris.ac.uk/subversion/genie/trunk --username  ~/genie

=Quick Start=

The example above, shows how to checkout the trunk of the GENIE repository using the command-line client. (We will cover branches later.) We continue with more command-line examples below.

To update an existing checkout, simply cd to the highest-level directory (let's assume it's ~/genie) and issue the update command: cd ~/genie svn update (You could update a sub-tree of your checkout by changing directory to, say, ~/genie/genie-embm and then calling "svn update".)

If you have created a new file, you must first add it to your local checkout. (The action of adding it tells SVN that there is a new file which the repository must store, and schedules it for addition to the main repository when you next call "svn commit". More of svn commit in a moment): svn add or, for example: svn add *.f90 To add a group of files en masse.

Similarly, to delete a file: svn delete or: svn del *.f

Once you have made your local changes, you should test them before committing any of them back to the repository. Type: make test make testebgogs make testbiogem to run the IGCM- and EMBM-based short tests respectively (note that the BIOGEM test is based on an EBGOGS config').

Once your tests pass with an "**OK**", then you can go ahead and commit your changes: svn commit -m "type your message here" Note that SVN and CVS differ in their behaviour here. You can see from the above example that we do not specify a file to go with the "svn commit" command. With SVN, we are commiting the current state of your working copy. A successful commit will then advance the version number on the SVN repository by 1. Thus we can see that SVN uses version numbers differently to CVS. SVN gives the entire repository a version number and increments this whenever there has been a change. This is unlike CVS, where individual files have their own individual version numbers.

To see the history of a given file, type svn log

To check-out one of the stable releases of GENIE, you can use: svn checkout https://source.ggy.bris.ac.uk/subversion/genie/tags/rel-2-1-0 --username  ~/genie

To find out more SVN options type: svn --help