Submission Instructions - Using SVN

You may find this SVN Tutorial Screencast helpful.

If you wish to access SVN directly through Eclipse, you may find Prof Jung's SVN Instructions in Eclipse page helpful.

All of your code must be checked in to your SVN repository prior to the deadline.

Subversion, or SVN, is a version control system. It allows you to keep your code in a centralized repository and access it from any machine. It also allows collaborators to work on a common project in a seamless way. Finally, it allows you to "roll back" to previous version of your code in the event that you make changes you do not want to keep.

SVN works as follows: all of your code is stored on a server. Each time you wish to work, you update a local copy of your code. When you complete your work, you upload your changes to the server.

The SVN client installed on the department linux machines can be accessed from the command line using the svn command. If you use a windows machine, you should consider downloading an appropriate client from here: http://subversion.tigris.org/getting.html

For windows, I recommend using Tortoise SVN. It allows you to perform SVN operations by right-clicking on files in the Explorer window.

You can also download an Eclipse plugin http://subclipse.tigris.org/ that allows you to check out and commit code directly from the Eclipse IDE.

Your SVN repository is located at https://www.cs.usfca.edu/svn/<username> The list command will list all of the directories in your repository. To list the contents of your repository, run the following command replacing srollins with your user name.

svn list https://www.cs.usfca.edu/svn/srollins

Step 1

Create a directory within your repository where you will keep all of the code for a particular course. This is done one time for each course using the mkdir command. The command looks as follows. You will replace srollins with your user name, cs112 with the appropriate course number, and "add directory..." with a comment describing the purpose of the directory.

svn mkdir https://www/svn/srollins/cs112 -m "add directory for cs112"

Step 2

Check out the directory. This must be done one time on every machine where you wish to access the code in a given directory. The co command makes a local copy of the contents of a given directory. You will replace srollins with your user name and cs112 with the appropriate directory.

svn co https://www/svn/srollins/cs112

Step 3

Add new files. This must be done any time you wish to add new files or directories in the directory created in Step 1. If you have checked out directory cs112, you may cd into that directory and create new directories (locally) using the mkdir command. For example, you might cd into the cs112 directory created in Step 2 and type:

mkdir lab1

This creates a local directory lab1. To add it to the repository on the server, use the add command:

svn add lab1

You may also cd into the lab1 directory and create a new Java file Test.java. You must also add that file.

Step 4

Commit changes. This should be done after each round of changes to your code or directory structure. For example, to submit the changes you made in Step 3 to the server, you would use the commit command. You will replace the text in quotation marks with an appropriate remark.

svn -m "lab 1 directory created" commit

Step 5

Update working copy. This must be done each time you wish to work on code that may have been updated at the server. If you cd into the local cs112 directory, you can use the up command to download any changes on the server to your local machine.

svn up