UW-Madison
Computer Sciences Dept.

CS/ECE 552 Introduction to Computer Architecture Spring 2010 Section 1
Instructor David A. Wood and T. A. Tony Nowatzki
URL: http://www.cs.wisc.edu/~david/courses/cs552/S10/

Example SVN Usage

1.  Checkout

To keep your joint project work separate, we will checkout your repository into a new directory.

prompt> svn co $YOUR_SVN_DIR cs552_proj_work



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 Brain

Day 0

Initial checkout

prompt>cd ~;
prompt>svn co $YOUR_SVN_DIR cs552_proj_work

Initial checkout

prompt>cd ~;
prompt>svn co $YOUR_SVN_DIR cs552_proj_work

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.
prompt>

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 the brain has made:

prompt>svn status -u

       *            alu.v
       *       25   decode.v

prompt>

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.
prompt>
  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.
prompt>

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:

prompt>svnprettydiff

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:

prompt>whoami
pinky

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 invoking the handin command:

prompt>handin -c cs552-1 -a demo1 -d $YOUR_SVN_DIR/demo1
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




 
Computer Sciences | UW Home