Subversion

From Icbwiki

Jump to: navigation, search

Subversion is a version control system that is a compelling replacement for CVS.

Contents

SVN Repository

The ICB Subversion repository root is https://pbtech-vc.med.cornell.edu/public/svn/icb/. Projects can be checked out through SVN with the following instruction set:

 $ svn co https://pbtech-vc.med.cornell.edu/public/svn/icb/trunk/<projectname>

where <projectname> is the name of the project you are working on.

You can also browse the Subversion repository.

Directory Layout

The ICB Subversion repository contains the following main subdirectories.

Trunk

This directory contains the main development "trunk" for the various icb projects such as TissueInfo, Twease, BDVAL, etc. Code in this directory should be considered reasonably stable. Additionally, many project in the trunk are continuously tested using CruiseControl.

Tags

This directory contains tagged versions of projects found in the trunk. These are essentially snapshots in time of the state of a particular project. Tags are often used represent a "formal" release of a particular project (i.e,, tissueinfo_20090429161957, bdval_1.0.1, etc.). Tags may be also used as a convenient checkpoint mechanism when a major new feature is introduced into a project. Creating a tag called "project_1.0" from "project" with subversion can be done by issuing the following command:

  $ svn copy https://pbtech-vc.med.cornell.edu/public/svn/icb/trunk/project \
        https://pbtech-vc.med.cornell.edu/public/svn/icb/tags/project_1.0\
        -m "Tagging the 1.0 release of the project."

Branches

The branches directory contains projects that are undergoing development parallel to the trunk. Often project in these directories get merged back into the corresponding directory in the main trunk. It may be the case that a branch is experimental and never merge back into the main trunk or become a totally new project within in the trunk. There is no difference "under the hood" between a tag and a branch so the creation of a branch is exactly the same as creating a tag except the destination is different.

3rdparty

The 3rdparty directory contains projects that were not initially developed by the ICB but are useful. Some projects in this directory have been modified from their original codebase in which case an effort may be made to contribute the changes back to the original authors.

Shelves

The shelves directory is intended as a place for individual users to store code under development that may not be ready for integration into the main trunk and may not warrant a "formal" or "public" branch. The shelf concept is described in detail in the Subversion and Shelving article. Shelving is particularly useful when developing code from multiple locations (i.e., office, home, while traveling, etc.). Each user has their own directory within the "shelves" hierarchy (i.e., "shelves/marko", "shelves/campagne", "shelves/kdorff", etc.). While there is no formal policy on the layout of each users shelf, having a separate subdirectory for each project is recommended to be consistent with the trunk.

Shelving example

For example, if you ("user") want to continue working on "project" and test it before merging it back into the head you would copy the current code to your shelf by issue the following command:

 $ svn copy https://pbtech-vc.med.cornell.edu/public/svn/icb/trunk/project \
       https://pbtech-vc.med.cornell.edu/public/svn/icb/shelves/user/project

Having created the copy, you can check it out like so:

 $ svn checkout https://pbtech-vc.med.cornell.edu/public/svn/icb/shelves/user/project

OR, if you already have a working copy of the trunk checked out you can just switch your workspace to the branch with:

 $ svn switch https://pbtech-vc.med.cornell.edu/public/svn/icb/shelves/user/project

The advantage of switching is that it will take with you all your uncommitted changes into your "new" working copy.

There are two things which you will most likely need to know when working on your shelf. The first is how to merge an updated trunk into your shelf so you can test your version with the latest code AND you will need to know how to merge the changes you made on your shelf back into the mainline.

After completing work on the shelf version to a point where it is ready to go back into the trunk you should do the following from your local working directory:

1. Commit all changes to the shelf

 $ svn commit -m "Preparing for merge with trunk"

2. Switch the working copy back to the trunk

 $ svn switch https://pbtech-vc.med.cornell.edu/public/svn/icb/trunk/project

3. Merge all the changes on the shelf from when the shelf was created right up to now into the working copy (which is now the trunk, not the shelf)

 $ svn merge -r141:HEAD https://pbtech-vc.med.cornell.edu/public/svn/icb/shelves/user/project

4. Having done this, all the changes made to the shelf between revision 141 and the current HEAD revision been have merged into the working copy. If you am satisfied that everything is in order I can go ahead and commit the current copy to the trunk

 $ svn commit -m "Merged changes from my shelf into the trunk"

Guest Access

To access the subversion repository if you do not have a local ICB account, use the username guest and supply your email address for the password. This is a read only access method.

Tools and Utilities

There are command line binaries available for most unix systems and also for Windows based PCs via Cygwin. Additionally, TortoiseSVN is a Subversion client for windows implemented as a shell extension and provides all subversion commands directly from the windows explorer.

TortoiseSVN Settings

By default TortoiseSVN will use it's own internal comparison and merget tools. TortoiseSVN can be set up to use Araxis Merge to compare and merge files in the subverion repository with the following settings.

  • Diff Viewer "C:\Program Files\Araxis\Araxis Merge v6.5\compare" /wait /title1:"Mine" %mine %base
  • Merge Tool "C:\Program Files\Araxis\Araxis Merge v6.5\compare" /wait /a3 /3 /title1:"Mine" /title2:"Theirs" /title3:"Base" %mine %theirs %base %merged

References

Personal tools