UCSD notes on subversion

From Vision Wiki
Jump to navigation Jump to search

The following notes are from the UCSD ComputerVision Lab. Thank Piotr for providing them.

Quick Overview

The SVN repository root is located at:

  svn+ssh://username@vision.caltech.edu/projects/p1/svnroot/
  • Recommendations:
    • Using Passwordless SSH helps a lot (see below)
    • Setting an environment variable $SVNHOME saves a lot of typing.

Quick Subversion Command Overview

  • To List the contents of the repository:
  svn ls $SVNHOME/

or

  svn ls $SVNHOME/path/to/dir
  • To check a project out from the repository:
  svn checkout $SVNHOME/path/to/prj
  • To create a folder in the repository:
  svn mkdir $SVNHOME/path/to/folder
  • To add a file to version control: (file must reside in a folder under version control)
  svn add file
  • To remove a file:
  svn rm file

Unix Walkthrough

  • I would suggest storing the location of the repository in $SVNHOME.
    • If you use bash, edit ~/.bashrc and add the line:
  export SVNHOME="svn+ssh://lumo.ucsd.edu/projects/p1/svnroot/"
    • in tcsh, edit ~/.cshrc
  setenv SVNHOME svn+ssh://lumo.ucsd.edu/projects/p1/svnroot
  • to make sure your url is correct, type svn ls $SVNHOME. You should see something like:
 [WindUp-Bird:~] stephan% svn ls $SVNHOME
 Matrix/
 MoVs/
 attendtrack/
 egGame/
 euler/
 gmm/
 hoc/
 infinity/
 lhor/
 lpr/
 mvp/
 nmds/
 optimal/
 pineapple/
 piotrNIPS06/
 psycho/
 relax/
 robust/
 robusto/
 shadowcuts/
  • now you need to add your project to the list.
    • make sure you clean (using make clean or scons -c) in before you import.
 mv myproj/ /tmp/myproj
 svn import /tmp/myproj $SVNHOME/myproj/ -m "initial import of Myproj"
  • PROJECT CHECKOUT regardless of wether you imported your project into the repository or all you want to do is access code that is there, you're going to need to check the project out:
 svn checkout $SVNHOME/myproj myproj/
  • From here on out, refer to the svn commands overview so that you understand the mechanics of the system.
  • now you're good to go. Use svn commands update, merge and commit.
  • Easy passwordless SSH:
 ssh-keygen -t rsa
 # hit return three time
 ssh-copy-id -i ~/.ssh/id_rsa.pub username@remote_host
 # enter your password for username on remote_host

Xcode (Os X) Walkthrough

  1. Create a new project, myproj
  2. follow the above steps (the unix walkthrough)
  3. after you've checked the project out, re-open it in xcode
  4. go to project info. The easiest way to do this is click on the project name (myproj) on the left pane and do apple-i.
  5. at the bottom of the window, there should be a check box next to `enable scm'. Turn this on, and select `Subversion' from the nearby pulldown.
  6. this enables the `SCM' menu, which you can use to execute all your favorite (and least favorite!) svn commands.

Windows Walkthrough

Install Tortoise SVN, this client will do everything you need, except store your psswrd, for which you need passwordless SSH (see: [ http://wiki.cleversafe.org/Caching_passwords_with_tortoisesvn Passwordless SSH with putty and TortoiseSVN]). This is essential, ow you may need to enter/reenter you psswrds dozens of times per operation. Afterwards, use Tortoise SVN for everything (right click in a folder to bring up a context menu). All the standard SVN commands (update, commit, checkout, add, delete, etc.) are available through the context menu. Also of use is the repo-browser for creating new project directories, etc., in the repository.

Note: make sure that when you type in the URL of the svn, you include your username as follows: svn+ssh://username@lumo.ucsd.edu/projects/p1/svnroot ; OR you can go into TortoiseSVN settings->network and type "C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe -l <username>" (replace <username> with your username; and make appropriate changes to the path of TortoisePlink.exe).

External Resources