Basic Subversion for SWIM
Subversion (svn) is essentially the next generation of the Concurrent Version System (cvs), and CVS users will find it works very similarly. This documentation assumes that you understand the basic concepts of version control, as embodied, for example, in CVS. For more details, consult the Subversion book (URL below) or Google for other resources.
In the examples below, we will refer to the IPS code repository on the SWIM web site.
- Most relatively new installations probably have it installed. Check for the "svn" binary. If not, you can download the latest version from the Subversion web site, below.
- Sorry, no experience.
- The TortoiseSVN client is generally recommended. See URL below.
Checking Out a Repository
svn checkout repositoryURL path
svn co https://cswim.org/svn/cswim/ips/trunk ips
Note: "co" is a synonym for "checkout".
Subversion always refers to a repository using a URL. It may be to a web server (
https protocols), a local file (
file protocol), or Subversion's own internal protocol (
You will be prompted for a username and password for authentication (it is also possible to use
ssh in conjunction with the
svn protocol, as many CVS users are accustomed to doing). For repositories under
https://cswim.org/svn/cswim you should authenticate with the same username and password you use for the SWIM web site.
Note that if the username you use to authenticate on the Subversion server is different from the one you're using on the client system, you may have to put that into the URL, such as
Note that when using the
https protocol, the connection is secured with SSL, and you may see messages about the server's certificate. These are the same as you would see in a browser when connecting to the site, and should be treated the same way.
The example URL can be broken down as follows:
- This is the location of the SWIM project repository on our server.
- This is the subproject.
- This means we're going to work with the main branch of development, which is also known as the trunk. By convention, Subversion projects have
tagsdirectories at this level. More advanced uses of version control include using branches to allow parallel development while minimizing conflicts, and tagging specific configurations of code for later reference, such as specific releases which might be posted to a web site. The
tagsdirectories are conventional locations to store such versions of the repository.
The final "path" argument is optional, and is used to set the directory name for your working copy. The default is to use the last element in the URL. However if you follow the conventions noted above, you'll end up with a lot of directories called "trunk", which isn't very meaningful.
Basic Subversion Commands and Workflow
Here are brief descriptions of some of the most commonly used Subversion commands. For more details try
svn *command* --help or the Subversion book (URL below).
- Shows current status of files in working directory relative to the repository. Similar to
cvs update -n.
- Updates the working directory from the repository. Similar to
svn commit --message <message> [files]
- Commits local changes into the repository. Note: "ci" is a synonym for "commit". Files must be up to date with respect to the repository.
svn revert file
- Abandon local changes by reverting to a pristine version from the last checkout/update. Can also be used to abandon operations like file addition/removal before they are committed to the repository.
- Do what you would expect from their names. Note that in Subversion, directories are version controlled and renaming operations of files or directories can be done with
moveto preserve history. These are not features found in CVS.
- Recursive addition of a tree of files to a repository.
Key Differences between CVS and Subversion
- Versions are global. Whereas in CVS, each file had an individual version number, in Subversion, the entire repository has a single version number. The version number is a simple integer, and is incremented with every
svn commitoperation. Thus, it is common to see references to version numbers like "5263" for Subversion-managed codes.
- Subversion has atomic changesets. This is a corollary to the fact that version numbers are global. All of the changes made in a single commit operation are treated as a single revision to the repository.
- Subversion manages directories as well as files
- Subversion understands renaming of files and directories
- Subversion project web site
- TortoiseSVN (Subversion client for Windows)
- Version Control with Subversion (online version of book)
- Subversion for CVS Users
- Subversion Best Practices
- SVN for NIMROD Users
Last modified 2010-10-28 13:39