Use Subversion at CSE
How to use Subversion at CSE
Introduction
What is Subversion? The Subversion project is a version control system aimed at replacing CVS in the open source community. It is a very useful tool and a here at CSE we are hoping to use it as a centralized repository for our open source code.
Create a New Project
If you would like to start using the CSE subversion server all you need to do is send the following information to technical support and we will create your project.
- Your project name (please be detailed and include any preferred short name where the short name contains no spaces or special characters)
- Who should be modifying the documents stored in subversion (CSE affiliates only, campus affiliates only, or anyone in the world)
- Who should be modifying the wiki and or tickets in trac (CSE affiliates only, campus affiliates only, or anyone in the world)
- Should anonymous internet users be allowed to read source code?
Repository Organization
You can organize your project in any way you wish, but we have some recommendations in this area. We recommend using a base directory for the trunk, tags and branches. Once you know your project's short name (aka project_shortname) you can execute the following commands to set up your repository.
$ svn co https://svn.cse.ucdavis.edu/repo/project_shortname # check out the project
$ cd project_shortname
$ svn mkdir trunk
$ svn mkdir tags
$ svn mkdir branches
Trunk
The trunk should be used for importing your code for the first time. This is where the main stream of development (also know as the HEAD) is located. To check something out of the trunk use the following command.
$ svn co https://svn.cse.ucdavis.edu/repo/project_shortname/trunk project_shortname
Tags
Tags are a great way to make snapshots of an entire source tree. You are essentially copying a tree to another directory. Many find that it is helpful to name versions using tags (ie release-1.0.2) or to name feature bases with tags (ie pre-loop-optimization). To tag the trunk use something similar to the following command.
$ svn copy https://svn.cse.ucdavis.edu/repo/project_shortname/trunk \
https://svn.cse.ucdavis.edu/repo/project_shortname/tags/release-1.0.2 \
-m "Tagging the 1.0.2 release"
Branches
You can use branches to keep track of major forks in the code. Imagine you are planning to implement a particular module in a new way but you don't want to stop development on the old code. You can branch the code, test your changes and once it is stable you can merge the changes back into the trunk. To branch the trunk use something similar to the following command.
$ svn copy https://svn.cse.ucdavis.edu/repo/project_shortname/trunk \
https://svn.cse.ucdavis.edu/repo/project_shortname/branches/with-assembly \
-m "Branching the trunk. Investigating performance improvements using inline assembly code."
Using Subversion
Although there are a lot of more valuable resources available on the web here are a few shortcuts.
The Initial Import
Once the project has been added, and you have determined the repository organization you are ready to import your code. Run the following to import the code in your current directory into the trunk.
$ svn import . https://svn.cse.ucdavis.edu/repo/project_shortname/trunk -m "Initial Import"
Checking Out
If you want to change the source code you have to first check it out. You checkout code before you work on it to make sure you are working with the latest version. Run the following to checkout the trunk of project project_shortname into a directory called abc.
$ svn co https://svn.cse.ucdavis.edu/repo/project_shortname/trunk abc
Checking In or Commiting
So you have changed the source code and you want to submit the changes to the Subversion server. This process is called checkin code in (aka committing code). Run the following to check in the your code. This command assumes you have first checked the code out. The argument to -m is a message describing the changes you have made.
$ svn ci -m "updated module a to use inline assembly"
Using trac
trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. It's mission is to help developers write great software while staying out of the way. By default we have a trac installation for each project we host. The base URL for trac is https://svn.cse.ucdavis.edu/trac/. Append your project_shortname to get to your project's trac installation.
Other Help
Here are a few websites offering more help on the topic of version control, subversion and trac.