Fermilab


MINOS Offline Documentation
[home] [installing MINOS software] [supported platforms] [package links] [mailing list] [HyperNews] [FAQ] [computing help] [MINOS glossary] [archives]

subversion (svn)




Subversion

Subversion is the code management system that is supplanting CVS in the open source community. This not just a change of the client but the whole structure behind the scenes. In many ways it works in a similar fashion to cvs but it is incompatible in others; there are tools for exporting and importing svn repositories to/from cvs repositories as long as certain more advanced svn features are not used. But a client (code user) can not use one system to access a repository of the other type.

Unlike cvs, files are not individually tagged as versions. When a commit is made it should be the collection of all the relevant files that make up a consistent set of changes. The overall version is then incremented if all the changes were made. If any part of the commit conflicts with some other change then none of the files are modified.



Using Subversion

In many repects svn works in a manner very similar to cvs and commands look very similar. There are differences though both in syntax and some underlying principles (see above).

Since MINOS is not currently using svn for committing to a repository, this guide will focus only on those commands that a code user (e.g. not a developer) would need.

help

   svn help         # list all the commands
   svn help diff    # help for a particular command
   

checkout

The command to checkout the "HEAD" (bleeding edge of the development branch) of ROOT is:
    svn checkout http://root.cern.ch/svn/root/trunk mysubdir
    
The trunk is the main development branch. The mysubdir is an arbitrary directory name and could just as well be trunk or bleeding-edge as the user desires. The equivalent of CVS tagged releases are checkout via:
    svn checkout http://root.cern.ch/svn/root/tags/v5-17-03 v5-17-03
    

diff

Comparing the difference between a working copy and a tagged version looks something like:
    svn diff -r HEAD[:BASE]
    
where BASE means the working copy and HEAD is the latest of that branch. Comparing a tagged version to the trunk or another tag is a bit more work:
    svn diff http://root.cern.ch/svn/root/trunk  http://root.cern.ch/svn/root/tags/v5-17-04
    

a word about versions

The arg to the -r flag is the revision. It can be:
  • a number (e.g. 20392)
  • a date enclosed in curly braces, use single quotes to hide the braces from the shell (e.g. '{2007-10-16 5:01:21}')
  • HEAD which is the latestin the repository
  • BASE base rev of item's working copy
  • COMMITTED last commit at or before BASE
  • PREV revision just before COMMITTED

log

To print the commit log messages for all changes between the current working copy and the HEAD use:
    svn log -r HEAD:BASE
    

project tags

To list the available tagged versions use:
    svn ls --verbose http://root.cern.ch/svn/root/tags
    

status (changed files)

Checking which files in the working copy have local modifications (or are scheduled for addition/deletion) can be done by:
    svn status
    
Doing this does not need network acess and does not change the working copy. To see which items in the working copy are out-of-date (i.e. newer versions exist in the repository) use:
    svn status -u
    
Files that have been locally modified are indicated by a M, out-of-date files by *.
$ svn status -u
       *    20392   xrootd/src/xrootd-20071001-0000.src.tgz
       *    20392   netx/src/TXNetSystem.cxx
       *    20392   histpainter/src/THistPainter.cxx
       *    20392   geom/src/TGeoCone.cxx
       *    20392   geom/src/TGeoSphere.cxx
       *    20392   io/src/TBufferFile.cxx
?                   root_config.log
?                   root_build_map.log
?                   nohup.out
?                   root_build.log
?                   root_distclean.log
?                   config/Makefile.linux.original
M           20392   config/Makefile.linux
?                   root_build_cintdlls.log
Status against revision:  20404

General info about a working copy can be found with:
    svn info
    



Installing Subversion

Under Scientific Linux it may be available via a yum RPM installation if you have system privileges -- though the latest for SLF 3 or 4 seemed to be Subversion 1.1 which is pretty old. The current pages at http://subversion.tigris.org/ suggest that one want a version newer than 1.2.

If you don't want to go RPM route you can build and install the client code from source (you won't need the server code). On the FNAL nodes Subversion is installed in the $INSTALLATION area and proceeded along the lines of:

  1. cd /some/buildpath/
    This could be cd $INSTALLATION
  2. wget http://subversion.tigris.org/downloads/subversion-1.4.5.tar.gz
  3. tar xzf subversion-1.4.5.tar.gz
  4. wget http://subversion.tigris.org/downloads/subversion-deps-1.4.5.tar.gz
  5. tar xzf subversion-deps-1.4.5.tar.gz
  6. cd subversion-1.4.5
  7. ./configure --prefix=$INSTALLATION
  8. make
  9. make install

The -deps packages up some of the auxillary external libraries that Subversion itself depends on. Many of these aren't normally found on most systems.

On the Mac OS X one can get prebuilt binaries by following the links on http://subversion.tigris.org/project_packages.html to the Universal Installer.



Subversion and firewalls

If you are behind a firewall that blocks outgoing HTTP you will need to tell SVN about your web proxy server. Edit ~/.subversion/servers (if you don't have one first type svn help which will create it) to add lines like:
   [groups]
   root = root.cern.ch

   [root]
   http-proxy-host = proxy.foo.bar
   http-proxy-port = 3128   
   



Resources



Last Modified: $Date: 2007/10/22 11:00:38 $
Contact: minos_software_discussion@fnal.gov
Page viewed from http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/subversion.html
Fermilab
Security, Privacy, Legal Fermi National Accelerator Laboratory