Main »

Sharing Files for Project Through SVN


edit SideBar

Basically what we will do here is have both of you checkout files from one repository. I will set up file permissions so that both project partners can write to the repository.

We will define a new Unix environment variable called CS552_PROJ_REPOS which will point to this place. Both project partners must obviously define this variable to the same value.

Initial setup

Before going any further, one of the first things you must do, is add the following line to your .cshrc.local:

setenv CS552_PROJ_REPOS file:///p/course/cs552-karu/handin/user/CS552_REPOS/

Here user is the first username specified on the Project Team page when you signed up. For example; for the entry below.

    * Pinky, The Brain
    * pinky, thebrain

user = pinky

1.  Checkout

To keep your joint project work separate from your individual homework, we will checkout this repository into a new directory - we'll call this cs552_proj_work. Just like we did before, first go to the place where you want to place your cs552 stuff.

prompt> svn co $CS552_PROJ_REPOS/trunk cs552_proj_work

You will then see the following, just as before.

prompt> cd cs552_proj_work
prompt> ls
hw2/  hw3/  hw4/  hw5/  hw6/  project/  README.TXT

In the remainder of this tutorial, we will assume our project team partners are Pinky and The Brain.

2.  Both users can simultaneously develop

The key idea of SVN is it allows multiple partners to simultaneously edit different files. If they intentionally of inadvertently end up editing the same file, svn allows you to track that and merge/resolve these "conflicts"

Each project partner maintains their own working copy of the files. When they (lets say Pinky) make a change and are confident the change is correct, they "commit". At this point, the second user (thebrain) can do an "svn update" to get the changes that (pinky made).

3.  Example development flow and commands

Time Pinky The Brian
Day 0

Initial checkout

prompt>cd ~;
prompt>svn co $CS552_PROJ_REPOS/trunk cs552_work_proj 

Initial checkout

prompt>cd ~;
prompt>svn co $CS552_PROJ_REPOS/trunk cs552_work_proj
Day 1 pinky slacks off not doing much... thebrain is eager to work.
  1. Creates decode.v
  2. Edits alu.v

Must commit these to the repository. So pinky can see them.

prompt> svn add decode.v
prompt> svn commit -m "added decode and made changes to alu"
Sending alu.v decode.v
Committed revision 25.

How to check if pinky did something and commit to repository?

Check status of working copy against repository;

prompt> svn status -u
Status against revision:     25

Since no messages are reported by svn status, it means no other changes are in the repository. The working copy is up to date. Either pinky has done no work, or the work he's done has not been committed to the repository.

Day 1.75 Still slacking off... Getting impatient yells at Pinky to get some work done.
Day 1.95 Pinky gets act together and decides to work.

First check what changes thebrain has made:

prompt>svn status -u

       *            alu.v
       *       25   decode.v


This "*" indicates a new version of alu.v and decode.v exists in the repository. Detailed list of all svn status codes.

Pinky must now bring his working copy up to date to match repository.

prompt>svn update
A    decode.v
U    alu.v
Updated to revision 25.
  1. Pinky actually does some work.
  2. Reads through decode.v, discovers a bug and fixes it.
  3. Must now commit to svn
prompt>svn commit -m "fixed a bug in decoder. overflow not detected correctly"
Updated to revision 26.

Emails thebrain and says bug fixed in decoder..

Day 2
No work for today...

First wants to check what change pinky made before destroying working copy with questionable changes pinky committed!

prompt>svn status -u
       *       25   decode.v

This shows pinky did indeed commit something. thebrain wants to find out what the changes are:


Some output like this will show up. The light-red indicates a modified line. The actual modifications are shown in bold.

Example output

thebrain thinks these changes are ok. Wants to update working copy with these changes.

prompt>svn update
U   decode.v
Updated to revision 26.

Continues development.

Demo days arrives

Pinky and thebrain decide to submit from pinky's login.

First make sure it is pinky's login:


Good. Then make sure pinky's working copy is up-to-date!

prompt>svn status -u
Status against revision:     73

No lines shown, so means up-to-date.

Submit by creating tag demo1-submit

prompt>svn copy $CS552_PROJ_REPOS/trunk $CS552_PROJ_REPOS/tags/demo1-submit  -m "submitting demo1"

4.  Summary of commands

  • svn status -u
    • Check status of working copy against repository
  • svn update
    • Check status of working copy against repository
  • svnprettydiff
    • Show differences between working copy and repository
  • svn commit -m "comment"
    • Commit working copy changes to repository

5.  Add comments

Feel free to add comments here... (:commentbox:)

Page last modified on February 21, 2009, visited 1088 times

Edit - History - Print - Recent Changes (All) - Search