Motto: The palest of ink is better than the best
memory.
Chinese proverb
This page is set up to guide you through using CVS, a tool for file versioning. If you are moderately versed in CVS, you can safely skip this section.
For your project, you'll be starting from a code base provided by us and you will modify it extensively. Oftentimes, you'll find yourself in the situation of having modified the code in ways that render it unusable (such as during that 3 am coding binge), and you'll want to return to a previous version of your code, which you know it is stable. So you want to "turn the clock back".
Also, when two students are working on the same project, you'll want to be able to make changes to files concurrently and be able to merge changes into a single code base. Things can get rapidly out of control when using improvised tools (email, "Are you changing file X? Oops..." and so on).
On top of that, we (instructor and TAs) might occasionally fix the elusive last bug in the code base, and you'll need to merge those bug fixes with your own code that already contains your additions and changes. That might sound like magic, but it turns out there are simple line-oriented algorithms that can do a great job at merging similar text from various sources. A robust tool implementing such algorithms is CVS, which stands for Concurrent Versions System.
Here are the steps you need to take.
% ssh your_cse_username@instructional_server
% chgrpsh +cse401x
x
is a placeholder for a letter that will be
assigned to you by your TA. Students doing joint work will share the same
letter. It looks like nothing has happened, but in reality you are now
a member of the group cse401x for the remainder of the
session. You can check that by typing:
% groupsYou should see cse401x among your groups.
% cvsat the command prompt (%). You ought to see a help message.
Pick a directory for your repository, e.g. /projects/instr/qtr/cse401/x (where qtr is the code for the current quarter, e.g. 05au or 06sp) if you've been assigned 401 Unix group x, or some other directory in your own instructional file space if you haven't. We'll use repo-dir to refer to this directory in the instructions below.
Then execute the init
CVS command, like this:
% cvs -d repo-dir init
% mkdir myproj % cd myproj % cvs -d repo-dir co .This command will leave you with the directories CVSROOT and CVS in myproj.
*.class -k 'b' *.gif -k 'b' *.png -k 'b' *.pdf -k 'b' *.gz -k 'b' *.jar -k 'b'
% cvs commit -m "Updated cvswrappers"Note that in this case you don't need to specify the repository via the -d option. This is because CVS has planted its helper directories and looks up the repository name in a file called ./CVS/Root.
As of now, your repository is ready for prime time.
% cd temp % unzip MiniJava.zip % cvs -d repo-dir import -m "Initial release" . CSE401 MiniJava_1_0After importing, remove the temp directory.
% cvs checkout .You should get pretty much the same files that were in the zip file.
% cd myproj % cvs commit -m "Added cool feature"
% cd dir-holding-the-zip-file % unzip the-zip-file.zip % cvs -d repo-dir import -m "Version 2" . CSE401 MiniJava_2_0Note that you are issuing essentially the exact same command, but this time with a new version tag (and a new comment, which you can use later to identify versions). Again, after importing, remove the temporary dir-holding-the-zip-file.
Now your CVS repository contains your own work and our patches, nicely merged.
% cd myproj % cvs updateAgain, no need to specify the repository's directory because CVS looks it up in CVS/Root that the checkout command had created.
If you're adding new ASCII files, say "coolfeature.java", then you need to issue:
% cvs add coolfeature.javaIf you're adding new binary files, you need to use the -kb when adding:
% cvs add -kb coolicon.gifThe next time you do a cvs commit, your new files will be added to the repository.