Help Topic: Getting Started with SVN
Maintained by: mikerb@mit.edu Get PDF
Getting Started with Subversion (SVN)
Subversion (SVN) is a version control software that allows users to develop source code in a distributed manner, keeping track of changes, conflicts and versions. You will be highly encouraged to use SVN or a similarly capable version control tool during the course. But for now, we focus just on installing SVN and knowing just enough to check out software from the web to be used in the course.
Note: Subversion is the full software name, but the executable is svn.
How to tell if subversion is already installed [top]
Your machine may already have a version of svn installed. To check, try:
$ which svn /usr/local/bin/svn
If you get a response like the one above, you're all set. If svn is not installed you will get a response like the one below:
$ which svn svn: Command not found
If the which command is telling you the cannot find the svn command, you probably just don't have svn installed. However it may be that you simply don't have the directory containing the svn executable in your shell path. To rule this out, try the following (if using GNU/Linux):
$ cd /usr/bin $ which ./svn ./svn
or (if using OSX):
$ cd /opt/local/bin $ which ./svn ./svn
If you see the above, it is simply a matter of adding directory to your shell path. Do this now, or see the help topic on augmenting your shell path:
http://oceanai.mit.edu/ivpman/help/help-add-shellpath
Getting subversion in GNU/Linux [top]
If you're running GNU/Linux you probably have access to a package manager such as apt-get and already know how to use it to some degree. To install packages like Subversion, you need root privileges. Assuming your user accont has root privileges, do the following, and enter your normal login password if prompted:
$ sudo apt-get install subversion
See the discussion above on how to confirm whether svn has been successfully installed, and adjust your shell path if need be.
Getting subversion in OSX [top]
If you're running on a Mac (OSX) you can use MacPorts to install subversion. If you haven't installed MacPorts, see the separate help topic on this. To install packages like Subversion, you need root (admin) privileges. Assuming your user account has admin privileges, do the following, and enter your normal login password when or if prompted:
$ sudo port install subversion
See the discussion above on how to confirm whether svn has been successfully installed, and adjust your shell path if need be.
Using Subversion to check out a repository [top]
The Subversion executable is svn and takes a number of arguments on the command line for interacting with a software repository. The most essential is the command to checkout, i.e., download, a repository from a server.
$ svn checkout url
Many of the svn commands have a shorthand version. For example, co is shorthand for the checkout command. Below is the svn command for checking out the MOOS-IvP software tree:
$ svn co https://oceanai.mit.edu/svn/moos-ivp-aro/trunk/ moos-ivp
A checkout essentially results in the download of a directory from a server. The name of this directory is the component after the last slash character in the URL. In the above example, this would trunk. The last (optional) argument in the above example command line, moos-ivp, is the name you would like the directory to have upon download.
More can be learned about Subversion online. There are numerous help pages, cheat sheets, and the official Subversion book is even free online. On this course website we do have a few help pages of our own you can check out:
Page built from LaTeX source using texwiki, developed at MIT. Errata to issues@moos-ivp.org. Get PDF