Exercises
Getting Started.
In these exercises you will get to practice using a version control system, Subversion. In these exercises we will be using the SmartSVN client because it is cross-platform. Download and install the SmartSVN GUI from here. You may also choose to use a command-line client, or another Subversion client. If you do so, you’ll have to adapt the solutions we give to your client since our solutions are for the SmartSVN client.
Please attempt these exercises by looking back at what you learned in the Version Control lecture. If you get stuck, or don’t know what to do, there are links to solutions at the bottom of each exercise.
Exercise 1: Checking out.
We’ve set up a repository for the class. The repository URL is:
http://svn.software-carpentry.org/spring2011
You will need a username and password to access the repository. Your username is your family name followed by the first letter of your first name, all lower case with spaces removed. So, “John von Neumann” would have the username “vonneumannj“. Your password is “swc2011″.
- Use SmartSVN to check out a working copy of your repository.
- From the “Project” menu in the upper left corner, select “Check out”.
- Select the radio button for “Quick Checkout”. Fill in the “URL” field with the repository URL we gave above.
- On the “Local Directory” line, click the “Browse” button, and choose a place where you want to store the working copy of the repository on your computer.
- Click “Next”.
- If you get asked “Do you really want to check out the whole repository?”, select “Check out”.
- Click “Finish”.
- If you get an error, you might have your username or password incorrect. Click here to send us email, and we’ll get back to you ASAP.
Exercise 2: Modifying and Committing.
In your working copy you should see a folder called “participants” containing a folder with the username of each member of the class, including your own. You should find two files in your folder: planets.txt and temperature.txt.
- Open temperature.txt, and change the “January Low” for Winnipeg to -23.5.
- Save the file.
- Commit your change to the repository, being sure to include an informative comment.
- When prompted for authentication, your user name is, again, your last name, followed by the first letter of your first name. Your password is swc2011.
- Double click temperature.txt to open it in your text editor.

- Change the “January Low” for Winnipeg to -23.5.
- Save the file
- Back in SmartSVN, select the temperature.txt file, and click “Commmit”

- In the “Commit Message” box, give a meaningful comment, like “Changed the January Low for Winnipeg to -23.5.”
- Click the “Commit” button
- You will be asked for authentication. Your username is the your last name, followed by the first letter of your first name. Your password is swc2011.
- Click “Login”.
Exercise 3: Modifying and Committing… Again.
- Open planets.txt, and add a new second line, with * 10^6 miles typed directly under Mean Distance From Sun. (See the picture below).
- Save the file.
- Commit your change to the repository, being sure to include an informative comment.
Exercise 4: Resolve a Conflict
In this exercise, a different user is going to make a change to your planets.txt file and check it in before you check in your changes to the same file. This will mean you will have to resolve the conflicting lines before you can check in your changes.
We have written a special program that modifies the planets.txt in your repository folder as if it were another user. Visit the following URL:
and type in your username. When you hit submit you should receive a message saying planets.txt was successfully modified. DO NOT UPDATE YOUR WORKING COPY YET. Please follow the instructions below.
- Open up your copy of planets.txt
- There’s a typo! Change “Marz” to “Mars”.
- * 10^6 miles isn’t very readable. Change it to million miles.
- Save the file.
- Try to commit your changes. You should get an error.
- Update, resolve any conflicts, and commit your changes.
- Open SmartSVN. Select your working copy from the “Open Existing Project” pane. Click “Okay”.
- Double click planets.txt to open it in your text editor.
- Make the changes we described, and save the file.
- Back in SmartSVN, select the planets.txt file, and click the “Commit” at the top. Type your message, and click “Commit”.
- You will get an error, since you are not at the most recent revision. Click “Okay”.

- Click the “Update” button at the top.
- Now you need to resolve the conflict. Right-click on planets.txt. Go to “Query” and then “Conflict Solver”.

- In the Conflict Solver, the middle pane shows the current state of planets.txt. We want to select the “million miles” instead of the “1000000 miles”, so click the double arrows (>>) next to the “million miles” line in the left pane. In the middle pane, we can see that our “Mars” correction has been merged, and so has the information about Saturn that the other user added. These changes are fine, so we just leave them. Click “Save” at the top, and then close the Conflict Solver.

- Select planets.txt, and click the “Commit” button at the top. This time the commit should be successful.
Exercise 5: Reversing Local Changes.
- Open temperature.txt, and change the January high for Toronto to +600.
- Save the file, and close your text editor.
- Now use SVN to undo the change you made.
- Open temperature.txt, make the changes, save the file, and close your text editor.
- In SmartSVN, right-click on temperature.txt, and select “Revert”.
- If it asks you if you are sure, choose “Revert”.
Exercise 6: Reversing Committed Changes.
- Again, open temperature.txt, and change the January high for Toronto to +600.
- Save the file, and close your text editor.
- Commit your changes.
- Use SVN to reverse the changes in the latest version of the repository.
- Open temperature.txt, make the changes, save the file, and close your text editor.
- In SmartSVN, commit the changes.
- From the “Modify” menu at the top, select “Merge”.

- Type in the revision range. The start value for the range should be the revision before your most recent commit. The end value of the range should be HEAD. If you’ve been following these exercises to the letter, the range should be “6-HEAD”. If you’ve done some extra commits along the way, your start value might be more than 6.
- Select the “Reverse Merge” option. (You might have to deselect the “Enable xMerge” option first.)
- Click the “Merge” button.
- Open temperature.txt and verify that the change has been reversed.
- Back in SmartSVN, click the “Commit” button at the top, and in the message, explain that you have changed the Toronto January high back to -1.1. Click “Commit”.
Exercise 7: Adding and Committing a New File.
You will now make a new file, and add it to the repository.
- Make a new file called “interests.txt” in your personal repository folder.
- This file should contain a single line that starts with your name, followed by a colon, followed by a comma-separated list of your research interests. For example:
Henrietta Leavitt: astronomy, Cepheid variables, period-luminosity relationship
- Add this file to the repository.
- Commit your change to the repository, being sure to include an informative comment.
- Open your favourite text editor, and type your name and research interests into in the format given above.
- Save this file as interests.txt in the working directory of the repository (this is the same directory you used selected for “Local Directory” when you first checked out.)
- If you’ve forgotten where your working copy is, take a look at the Directories panel in SmartSVN.

- Go back to SmartSVN. You should see interests.txt in the main panel. If not, click “View” in the top menu, and go to “Refresh”.
- Select interests.txt and click the “Add” button.
- Click the “Commit” button (next to the “Add” button)
- Put a meaningful comment in the “Commit Message” box, and click “Commit.”
Exercise 8: Editing a shared file.
In this exercise, the unexpected may happen. You are going to add what you wrote in your personal interests.txt file in Exercise 7, to an interests.txt file shared by the rest of the class. Depending on who else is working on these exercises at the same time as you are, you might find you need to merge your changes in with theirs. Who knows!
- Open up the interests.txt file that is in the top-level folder of the repository (i.e. at the same level as the
participantsfolder. - Add your name and interests on a new line, as you did in Exercise 7.
- Commit your changes with a useful log message. You may need to update and resolve conflicts before you do.


Hi I am trying to do PART 8 and when I tried to merge (6-HEAD) it did not change the January High back to normal
nvm@Paradorn Pasuthip
I think with so many people using the same repository, the version numbers increase quickly. At my first checkout, I got revision 147 and worked from there.
I just completed the exercises. i only have issues with conflict resolution. It is interesting though.
I had no problems with using the SmartSVN client. However, the command-line subversion client currently running on my Debian Lenny 5.0.7 are older than SmartSVN’s. Although a workaround is provided (http://subversion.tigris.org/faq.html#working-copy-format-change), didn’t try that route as I’m not sure of possible side-effects. What do the TA’s suggest in that case?
I just completed the exercise, to my surprise, SmartSVN is not free……
@Zhuyi Xue No it isn’t, but it’s cheap, reliable, and, most importantly for us, easy to install, and runs (the same way) on all three major platforms (Windows, Linux, Mac). None of the free clients we tested last summer had these last two properties. but if you’re only using one kind of machine, something like TortoiseSVN may serve you well.