Tags:
create new tag
view all tags

SVN Tutorial for the SRVC

Here's a quick example of how I use SVN to access the SRVC project code. There are plenty of other general tutorials scattered across the web.

In the first section, I'll show how to add a project to SVN from existing source code you have elsewhere. Then, I'll show how to go about accessing projects and making changes. If you're not adding code to the repository, but only accessing an existing project, skip to the Standard Workflow section.

Please note that throughout this discussion, I am using an environment variable

$SVN_SRVC
. I have defined this to equal:
file:///lci/project/raid1/srvc/SVN
in a login script. Everything works as well simply substituting the full path.

Adding a Project

I have been working on a piece of saliency code which I'd like to add to source control so that it can be shared with others, and I can track my changes. You can see by the ls results that nothing fancy is happening so far. This directory can be code and binaries in any format:

> ls
./  ../  code/  code_backup/  initial/  player/  saliency/
> ls saliency/
./  ../  SaliencyToolbox/  depthModifiedSaliencyParams.m  firstTest.m  results/

Now, I would like to add the code to SVN in a sensible place. I can find out about the structure of the current repository with the svn list command:

> svn list $SVN_SRVC
CLASSIFY/
DOC/
ROBOT/
WEB/

I believe that the code I'm working on will fall inside the ROBOT group, as it's meant to be run during the image collection phase of the challenge, so I can use svn list again to get all of the information about this sub-directory with the -R flag:

> svn -R list $SVN_SRVC/ROBOT
initial/
initial/robotCode/
initial/robotCode/Makefile
initial/robotCode/PE_gaze.c
initial/robotCode/args.h
initial/stereoCode/
initial/stereoCode/Makefile
initial/stereoCode/README
initial/stereoCode/bb_id2210020.config
initial/stereoCode/bb_id5020143.config
initial/stereoCode/colour_rectify.cpp

I decide that I'd like to place my saliency code inside the ROBOT/initial directory, so I go ahead with an svn import:

> svn import saliency $SVN_SRVC/ROBOT/initial/saliency/ -m "Initial addition of saliency code" 
Adding         saliency/firstTest.m
Adding         saliency/depthModifiedSaliencyParams.m
Adding         saliency/results
Adding  (bin)  saliency/results/UBC31_Cat_9AttendedRegions.png
Adding  (bin)  saliency/results/UBC31_Cat_SaliencyMaps.png
Adding         saliency/SaliencyToolbox
Adding         saliency/SaliencyToolbox/mfiles
Adding         saliency/SaliencyToolbox/mfiles/displayMaps.m
Adding         saliency/SaliencyToolbox/mfiles/displayPyramid.m
Adding         saliency/SaliencyToolbox/mfiles/hueDistance.m
Adding         saliency/SaliencyToolbox/mfiles/discIOR.m
Adding         saliency/SaliencyToolbox/README

Committed revision 8.

Now the code is in the repository, and others can access it. From now on, I can always use the standard workcycle to make sure I'm synched up with other people's code, and that my changes are shared. I will back up this original version of my code somewhere to make sure it's safe, but from now on, I'll always actually work on copies that I get from SVN.

Standard Workflow

The standard workflow consists of the following operations:

  • Checkout (first time only), to get a local version of the code.
  • Update, to receive changes made by others.
  • Actually making your changes (which does not involve SVN).
  • Optionally adding or moving files if your changes have involved these operations.
  • Committing your changes back to the repository, so they are available for others.
  • Washing, and repeating.

Here goes. I want to work with the saliency project I discussed in the previous section of this tutorial. (Note that I already know the SVN path of the code I'm interested in here. I would use svn list to find this otherwise. I start by checking out:

> svn checkout $SVN_SRVC/ROBOT/initial/saliency
A    saliency/firstTest.m
A    saliency/depthModifiedSaliencyParams.m
A    saliency/results
A    saliency/results/UBC31_Cat_9AttendedRegions.png
A    saliency/results/UBC31_Cat_SaliencyMaps.png
A    saliency/results/UBC31_Cat_9AttendedRegions.fig
A    saliency/SaliencyToolbox
A    saliency/SaliencyToolbox/mfiles
A    saliency/SaliencyToolbox/mfiles/displayMaps.m
A    saliency/SaliencyToolbox/mfiles/displayPyramid.m
A    saliency/SaliencyToolbox/README
Checked out revision 8.

> cd saliency/
> ls
./  ../  .svn/  SaliencyToolbox/  depthModifiedSaliencyParams.m  firstTest.m  results/

Now, at this point I am quite sure that I have the most recent version of the code, but I can still run an svn update which will get me changes that others have made:

> svn update
At revision 8.

Now that I have an up-to-date version of the code, I can make changes. Assume that I changed the contents of the file firstTest.m and added the file segmentFloor.m. Afterwards, I can run svn status to make see what SVN thinks about the state of my changes:

> svn status
?      segmentFloor.m
M      firstTest.m

SVN knows that one file was modified, and it doesn't know about the new file that was added yet. I'll run svn add to tell SVN this is a new file I want included in the repository:

> svn add segmentFloor.m
A         segmentFloor.m

Finally, I'll commit my changes so that others can access them. Note that I'm leaving a comment so other people know what changes I made:

> svn commit -m "Modified saliency code, added depth segmentation of floor-plane"
Sending        firstTest.m
Adding         segmentFloor.m
Transmitting file data ..
Committed revision 9.

That's it. You now know how to use SVN. Note that you can almost never go wrong by running svn update and svn status as often as possible to make sure that you have a fresh version of the code, and that you're aware of what changes you've made locally. Have fun!

-- DavidMeger - 23 Mar 2007

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r2 - 2008-02-14 - DavidMeger
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback