Today's goal is to get you reasonably comfortable with the basics of subversion . Do the following exercises. After today, I'll clear all your experiments out of the appropriate places and we can start with a clean slate, so don't worry about making a mess.

Subversion

  1. Bookmark whichever incarnation of the subversion documentation you prefer (pdf, html, etc.). Use it to figure out how to perform the tasks in the rest of this lab.

  2. For this project, Mike Tie and his student workers have created a subversion repository. The repository is named cs257. For some operations (notably "svn checkout"), you will need an url: https://lime.mathcs.carleton.edu/svn/cs257 etc.

    To get started, check out your project using a command like "svn checkout https://lime.mathcs.carleton.edu/svn/cs257 cs257 --username cs257" (see the svn documentation for details). The first time you do this, you will be asked to accept an unsigned certification or some such thing, and you will be asked for the cs257 password. Your professor will provide you with the password.

    Take a look at the checked out directory. Unless somebody has left some testing files there, you'll probably see no data files. There will, however, be a directory named .svn. Take a look at the files in that directory. You won't edit these file manually (that's for the "svn" command to do), but it's worth having a sense of what kind of information subversion stores to support the work it does.

  3. Suppose you want a new subdirectory in your project directory. First, create the new directory and put some files in it. Then add the directory (svn add) to your project. Then commit your changes (svn commit).

  4. Have somebody else check out your project, make a change, and commit the change.

  5. Now that somebody has changed the project, your copy is not up to date. Update your copy using "svn update", and take note of the revision number (you'll use this revision number in a later step). Do you see the other person's changes?

  6. Delete a file from your project, and then commit the changes (note that "svn delete" does not change the repository--it changes your local information, and the changes will be made to the repository when you next do "svn commit". Go ahead and commit your changes.

  7. Both you and the somebody-else should now make changes to different portions of the same file (e.g. one person should change a word on the first line of the file, while the other person adds a line to the end of the file). When you have done so, you should both commit the project. Assuming both commit operations succeeded, you should now both update via "svn update". Look at the file you changed. Are both changes present on each person's copy?

  8. Now, both of you should change the same portion of the same file (e.g. each person should modify the same line of the file). Now, only the first person should commit his/her changes.

    Here's where it gets entertaining. The copy in the subversion repository is now identical to the copy held by the first person. But that copy is inconsistent with the copy held by the second person. The second person should now perform an update (svn update). What messages do you get from the update operation? Do a listing of your directory. If the file you have been changing is called thefile.txt, you should see thefile.txt, thefile.txt.mine, thefile.txt.rXYZ, where XYZ is the revision number of the first person's most recent commit operation. Compare the contents of these three files.

    The second person should now repair thefile.txt by actually speaking with the first person and agreeing on the appropriate changes. Then, the second person should commit the changes and delete the .mine and .rXYZ files.

    There are some important lessons here:

  9. Check out the revision that you took note of a few steps ago. Does it look right? Has the file you deleted reappeared?

  10. Export the same revision that you checked out in the previous step (make sure to use a different name for the exported directory). How does the exported directory differ from the checked out directory?

  11. Subversion is intended mostly for use with text files, but your projects can include binary files. For example, suppose you want to include an image file. Add such a file to your project. Does the "svn add" operation give you a different kind of response with a binary file than with a text file?