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 codebase 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 codebase. 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 TA) might occasionally fix the elusive last bug in the codebase, 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 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.
You create a repository by executing the init
CVS
command, like this:
% cvs -d /projects/instr/qtr/cse401/x init(where qtr is the code for the current quarter, e.g. 04au or 05sp)
% mkdir myprojThis command will leave you with the directories CVSROOT and CVS.
% cd myproj
% cvs -d /projects/instr/qtr/cse401/x co .
*.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 tempAfter importing, remove the temp directory.
% unzip MiniJava.zip
% cvs -d /projects/instr/qtr/cse401/x import -m "Initial release" . CSE401 MiniJava_1_0
% 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-fileNote 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.
% unzip the-zip-file.zip
% cvs -d /projects/instr/qtr/cse401/x import -m "Version 2" . CSE401 MiniJava_2_0
Now your CVS repository contains your own work and our patches, nicely merged.
% cd myprojAgain, no need to specify the root directory because CVS looks it up in CVS/Root that the checkout command had created.
% cvs update
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.