Doing Homeworks with Subversion

Knowing how to use a revision control system is an essential skill for a software developer, and subversion (svn) is one of the more popular systems out there. To develop this skill, we will use subversion throughout the class both for software development, and for homework turn-in.

The homeworks in this class will all in one way or another contribute to a larger project, which you will be developing throughout the course of the semester. Rather than turn in independent pieces of code for each homework, you will turn in a "revision" of your project, which is expected to have a certain set of features.

Following the turn-in time, solutions will also be made available through svn. You are welcome to use any or all parts of the solutions in a prior homework when completing a subsequent homework, but you are encouraged to continue building upon your own code where possible - it will be a valuable experience in its own.

svn accounts and passwords will be handed out in class. Once you have these credentials, you may proceed to check out your submission directory from your personal repository by running the following command:

svn checkout --username USERNAME svn://

This is the main project directory, in which you should store all your work. To add a file, create the file in the desired location, then run the command

svn add THEFILE

followed by

svn commit THEFILE -m "Added THEFILE for a good reason that I describe here."

this permanently stores this revision of THEFILE in the repository. Later, when you have some files in your directory, and want to store a new version in the repository, you would run "commit" once again, for example:

svn commit -m "Changed function parameters to conform with homework3 parsing requirements."

This automatically commits the current revision of all the tracked files in the current directory. Note that files initially have to be added with "svn add" before revisions can be committed. To check on the status of all the files in your directory, use

svn status

which lists all the files that have something unusual about them:

? Not tracked by repository
M Local version is newer than repository

given that you will not be sharing a lot of code, these are the main statuses you'll be seeing. Sometimes, when using shared code from the class directories, or if you are writing your code on multiple machines concurrently, you may also encounter:

U Newer version exists in repository
C A conflict was detected when updating local version

If you get an "U", all you need to do is run "svn update". A "C" on the other hand means that there is trouble. You will need to first edit the file to find the conflicting parts (marked with ">>>>>>>>"), clear up the confusion, and then run "svn resolved THEFILE" to inform svn that you fixed the problem. Finally, you may want to run "svn commit" to get the newest version into the repository.

Topic revision: r1 - 2012-08-27 - 21:40:01 - Main.jakob
Copyright 2016 The Board of Trustees
of the University of
Helping Women Faculty Advance
Funded by NSF