Exercise 2 - Conflicting updates in CVS

 

Goal: Gain familiarity with how CVS handle simultaneous updates

 

We suggest you work in teams of two or three. So implicitly, we'll assume that there are three, who will work at a single machine, but in directories called student10, student20 and student30. (You can also do this between groups on different machines if you want to)

 

To avoid interference, first create a unique repository that the three of you will use:

 

cd

tar xf ~jake/CSC/exercise2.tar

 

This has created the directory "repo2" in your home directory. This contains the same two "CodeA" and "CodeB" packages that you saw in the first exercise.

 

Now set the CVSROOT environment variable so that the repository can be used:

 

cd ~

export CVSROOT=$PWD/repo2

 

We'll work with CodeB. Each of you should create a temporary work directory, and check out the source package (Again, note that you’re all sharing a single login account, so you can access these files, but you’ll be taking turns at the keyboard and working in different directories)

 

cd

mkdir ~/student10

cd ~/student10

cvs checkout CodeB

 

cd

mkdir ~/student20

cd ~/student20

cvs checkout CodeB

 

cd

mkdir ~/student30

cd ~/student30

cvs checkout CodeB

CodeB contains files Text10, Text20, and Text30, each of which contains several paragraphs, each of which contains a number of obvious errors (numeric, capitalization, punctuation).

 


First, we want to simulate parallel development on independent files in a single package.

 

Each student should take one of the files, edit a couple of the changes into the file in their subdirectory, and commit their changes back to the repository. Switch around at the keyboard a couple times, and convince yourselves that these will be all independent.

 

CodeB also contains file TextSeparate, which has three numbered paragraphs in it. We're now going to have the three of you edit different parts of the same file.

 

Each student should, in turn, edit some changes into the paragraph labeled with their number in the file in their directory, update the file to the HEAD version with "cvs update -A", then commit their changes. Take a look at the file before and after the update, and see how CVS merges in your colleague’s changes. You can also update before editing, have two students edit & separately commit. You can also provoke an error by trying to commit without doing the update (assuming somebody else have committed changes). Try various combinations of all these operations; in each case, you should not encounter any conflicts, as the lines you are editing appear separately in the file.

 

Next, we want to explore how CVS deals with conflicts, which are edits to overlapping lines. We've covered the cause and solution in the lecture, and you'll try to provoke it here.

 

The file TextOverlap is meant to be the test case for this. It has just a small header in it now. You're to each edit in and commit your name in alphabetical order. As you've already checked this file out (without anybody's email address), the first person to commit will not encounter any conflicts. If the others edit, then update, however, they are likely to encounter conflicts during the cvs update. Use your favorite editor to correct the overlaps, then commit.

 

As a final exam for this exercise, we would like you to correct all the capitalization, spelling and numerical errors in the files TextFinal1 through TextFinal3. To make it more challenging, we want you to split the work out - one should fix only the spelling errors, another the numerical errors, and the third the capitalization. Try to do this in parallel, with each of you editing and committing asynchronously. We've provided three example files so you can try several different approaches, and see which works best. We suggest you try "Edit everything, then do a single commit at the end", "commit and update often, in little bits, as you go along", "update often, commit only at end".