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.

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

svn checkout svn:// --username USERNAME

This is the main turn-in directory, in which you should store all your work. Many homeworks come with template code. To retrieve the template, go to your turn-in directory, then run:

svn export svn:// where X is the number of the homework in question. This retrieves an un-tracked copy from the public repository. NOTE: do not use svn checkout for this! Then, add this entire template directory to your turn in repository, by running

svn add hwX and

svn commit hwX -m "added hwX" to commit the changes to the server.

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.

This topic: CS385spring12 > Subversion
Topic revision: r2 - 2012-01-11 - 04:47:48 - Main.jakob
Copyright 2016 The Board of Trustees
of the University of
Helping Women Faculty Advance
Funded by NSF