Schedule LabAssignments LabInstructions

Lab Two

Exercises

Exercise 2.1

Check out your branch of the code like so:

$ svn co --username username svn://mngrid.ucsd.edu/scicomp/branches/username

where username is your Trac/SVN username.

This will a create a directory called scicomp in your current working directory. Unless otherwise noted, the exercises below assume that you have done this, and that your working copy is in a directory called scicomp.

Exercise 2.2

Create a file scicomp/ex01/bio.txt (where scicomp is the root of your working copy of your Subversion repository), and write a short biography of yourself (100 words or so). Commit this file to your repository. Remember to provide a meaningful comment when committing the file!

Exercise 2.3

What's the difference between mv and svn mv? Put the answer in a file called scicomp/ex01/mv.txt and commit your changes.

Once you have committed your changes, type svn log in your scicomp directory. If you didn't know what you'd just done, would you be able to figure it out from the log messages? If not, why not?

Exercise 2.4

In this exercise, you'll simulate the actions of two people editing a single file. To do this, you'll need to create a couple of different directories to check out the into. In the parent directory of scicomp, make two directories, Green and Blue; now, check out your branch into each of those directories:

$ ls
Blue Green scicomp
$ svn co svn://mngrid.ucsd.edu/scicomp/branches/username/scicomp Blue
$ svn co svn://mngrid.ucsd.edu/scicomp/branches/username/scicomp Green

Step 1

Create Blue/ex01/planets.txt, and add the following lines:

Mercury
Venus
Earth
Mars
Jupiter
Saturn

Commit the file.

Step 2

Update the Green repository. (You should get a copy of planets.txt.)

Step 3

Change Blue/ex01/planets.txt so that it reads:

1. Mercury
2. Venus
3. Earth
4. Mars
2. Jupiter
6. Saturn

Commit the changes.

Step 4

Edit Green/ex01/planets.txt so that its contents are as shown below. Do not do svn update before editing this file, as that will spoil the exercise.

Mercury 0
Venus 0
Earth 1
Mars 2
Jupiter 16 (and counting)
Saturn 14 (and counting)

Step 5

Now, in Green, do svn update. Subversion should tell you that there are conflicts in planets.txt. Resolve the conflicts so that the file contains:

1. Mercury 0
2. Venus 0
3. Earth 1
4. Mars 2
2. Jupiter 16
6. Saturn 14

Commit the changes.

Step 6

Update the Blue repository, and check that planets.txt now has the same content as it has in the Green repository.

Exercise 2.5

Add another line or two to scicomp/ex01/bio.txt and commit those changes. Then, use svn merge to restore the original contents of your biography (scicomp/ex01/bio.txt), and commit the result. When you are done, bio.txt should look the way it did at the end of the first part of the previous exercise.) Note: the purpose of this exercise is to teach you how to go back in time to get old versions of files—while it would be simpler in this case just to edit bio.txt, you can't (reliably) do that when you've made larger changes, to multiple files, over a longer period of time.

Exercise 2.6

Subversion allows users to set properties on files and directories using svn propset, and to inspect their values using svn propget. Describe three properties you might want to change on a file or directory, and how you might use them in your current project.

Exercise 2.7

Make gets definitions from environment variables, command-line parameters, and explicit definitions in Makefiles. What order does it check these in?