wiki:SubVersion
Last modified 3 years ago Last modified on 03/03/14 15:20:42

Overview

You can browse the source using the Browse Source tab in Trac. Also, don't miss our EclipseHints and maybe OpenSsh too.

Command Line

Actual code checkin to subversion repository is accessible only via SSH via location svn+ssh://trac.biostr.washington.edu/src.

For example, list modules with

svn list svn+ssh://trac.biostr.washington.edu/src

You don't need Subversion environment variables except optionally SVN_EDITOR (default is nano). All authentication is done via SSH. If you'd like to try it out, I recommend reading the one-page SVN Quick Start. You can skip creating the repository (the "svnadmin create /path/to/repos" step), and replace the example URL file:///path/to/repos with svn+ssh://trac.biostr.washington.edu/src.

Checking out one file

Sometimes you need to edit just one file in a large project. Subversion supports sparse checkout:

svn checkout svn+ssh://trac.biostr.washington.edu/src/$PROJ/trunk --depth empty
cd $PROJ/trunk
svn up <file_you_want>
# edit file
svn commit -m 'awesome edit'

Creating a new project

Here are some quick commands to create a project using the command line, based on http://svnbook.red-bean.com/en/1.1/ch01s07.html.

PROJ=fooproj
svn mkdir -m "create $PROJ"  svn+ssh://trac.biostr.washington.edu/src/$PROJ
svn mkdir -m "create $PROJ"  svn+ssh://trac.biostr.washington.edu/src/$PROJ/trunk
svn mkdir -m "create $PROJ"  svn+ssh://trac.biostr.washington.edu/src/$PROJ/tags
svn mkdir -m "create $PROJ"  svn+ssh://trac.biostr.washington.edu/src/$PROJ/branches
# this will make mycode/foo appear at src/$PROJ/trunk/foo
svn import -m "$PROJ import" mycode svn+ssh://trac/src/$PROJ/trunk

You may want to make sure everything looks good and tag the initial import:

svn list svn+ssh://trac.biostr.washington.edu/src/$PROJ/trunk
# create a tag
TAG=initial-import
svn copy svn+ssh://trac.biostr.washington.edu/src/$PROJ/trunk \
         svn+ssh://trac.biostr.washington.edu/src/$PROJ/tags/$TAG \
      -m "Tagging the $TAG of the $PROJ project."

Subclipse plugin

IBM Devworks has a How to use Subversion with Eclipse tutorial

  • Install Ecplise
  • Install SubClipse plugin from http://subclipse.tigris.org/ and restart Eclipse
  • On 64-bit Windows or Mac, you may need a separate JavaHL download
  • If that doesn't work, on Windows, set:
    • Window->Preferences
    • Team->SVN
    • Choose "SVNKit (Pure Java)" instead of JavaHL
  • Window->Open Perspective->Other... and select "SVN Repository Exploring"
  • right-click and New->"Repository Location..."
  • in the dialog box URL put: svn+ssh://trac.biostr.washington.edu/src
  • enter username/password for SSH

trac Integration

When you commit code, your comments can be automatically added to trac tickets, or even close tickets if you use some magic words.

For example, the commit comment in changeset [85] was:

On each ticket page, this automatically appears as:

You may optionally put the word "ticket" before the "#" (i.e., "addresses ticket #5"). The full syntax is in the trac-post-commit-hook script.

In your commit comments, you can also use any WikiFormatting to link the changeset and tickets to wiki pages.

Converting a project

If you don't mind losing the CVS history, the easiest way is export the current HEAD from CVS, then import the files into subversion:

PROJ=mycode
cvs export -r HEAD  src/code/$PROJ
# import mycode at described above

Otherwise, investigate the steps mentioned at the SVN FAQ: Converting a project to SVN

subversion online book (local PDF copy)

Complete svn command referenece (or use svn help cmdname):

table reference of cvs vs svn commands

Notes on adding AppleScript SVN menu tools (primarily for non-developers)

Attachments