CVS and Tekkotsu

From Tekkotsu Wiki

Jump to: navigation, search

CVS (the Concurrent Version System) is the means by which the Tekkotsu source code is maintained and distributed. Several newer source control systems have become popular in recent years, such as subversion (svn), mercury (hg), and git, but Tekkotsu is sticking with cvs for now. There are many tutorials on cvs available on the web. This page focuses on information needed by Tekkotsu users rather than maintainers.

Contents

Setting Up Dot Files for CVS

The ~/.cvsrc file contains settings for cvs that work well for Tekkotsu. Putting the settings in this file eliminates the need to repeat them on the command line each time you do a cvs update. Creating an empty ~/.cvspass file eliminates a useless warning message. Both of these files should have already been set up if you followed the Ubuntu install instructions, but if not, you can set them up this way:

cd
wget http://Chiara-Robot.org/download/dot-cvsrc
mv dot-cvsrc .cvsrc
cat /dev/null >~/.cvspass

Downloading Tekkotsu From CVS

A full Tekkotsu installation requires a bunch of packages. Follow the directions in the Ubuntu install instructions to get the packages, then follow the Tekkotsu install instructions to install and compile Tekkotsu. To get the source code, you will be downloading Tekkotsu from the Tekkotsu CVS server. For reference, here is the command that does that:

cvs -d :pserver:anonymous@cvs.tekkotsu.org:/cvs co -P Tekkotsu

The Project Directory

Tekkotsu is normally installed in /usr/local/Tekkotsu, and it is normally compiled from /usr/local/Tekkotsu/project.

The Tekkotsu project directory is intended as a template for individual users' project directories. Thus, you should not put your own code in /usr/local/Tekkotsu/project. Instead, copy /usr/local/Tekkotsu/project to /home/user/project and put your own code there. This keeps the original project directory in synch with the cvs repository and free of extraneous files that might impact other users.

Most updates to Tekkotsu occur to other parts of the directory tree and don't involve the project directory. However, robot-specific kin and plist files reside in the project/ms/config and project/defaults directories, so when changes are made to these files, users will need to update their individual project directories by doing:

cd ~/project
cvs update

Updating Tekkotsu Through CVS

See the Software Updates article for complete instructions on how to update your Tekkotsu installation. The basic idea is to cd to the directory containing Tekkotsu, and then tell cvs to update the files from the CVs server:

cd directory containing Tekkotsu
cvs update

For reach file that is updated, cvs prints a message beginning with a one-character code indicating how the update went. The codes you will see are:

CodeMeaning
UUpdated the file
PPatched the file (a simple update)
MMerged the cvs version with changes you've made to the file
CConflicts found during merge
?Unknown file: not part of this CVS repository

The C code is the only problematic one. It indicates that CVS could not figure out how to merge in the changes it detected, so it left both versions in the file, separated by markers that look like <<<<<<< and >>>>>>>. Depending on the type of file, the markers are likely to cause compilation errors, parse errors, syntax errors, or some other kind of unhappiness. They must be removed.

The easiest way to remove the markers is to just delete the file and do another cvs update. However, if the file contains changes you want to keep, then you will need to manually edit the file to merge the two versions and remove the markers.

When Updates Fail

There are several ways that updates can fail. First, if you're on a network that blocks port 2401, you will not be able to access the cvs server. Speak with your network administrator to get the block removed.

Second, you might encounter a file permissions problem. When updating /usr/local/Tekkotsu you must be root. Do sudo -s to become root. On the other hand, when updating /home/user/project you must be "user", not "root". You can do the update as root, but it will cause the files to have incorrect ownership information, so future updates done as user will trigger permission errors. See the Linux Tips article for instructions for correcting file ownership information.

Third, cvs might report conflicts (code C) when updating a file. If you're not editing the Tekkotsu source code yourself, you should not see any conflicts unless a file somehow becomes corrupted. In that case, simply delete the file and do the cvs update again to pick up a fresh copy.

Finally, if you failed to notice a conflict when doing an update, you will get error messages when you try to recompile Tekkotsu due to the conflict markers cvs inserts. See the Troubleshooting Guide for advice on how to diagnose these errors.

Browsing the CVS Repository At cvs.Tekkotsu.org

You can examine the CVS repository using your web browser by visiting cvs.tekkotsu.org. This will allow you to see not only the latest version of each file, but the entire revision history. You can also use the site to compare versions to see what changed.

Reverting to an Earlier Version Of A File

If a cvs update breaks something, you can revert to an earlier version of the file by specifying an explicit revision number. Since files are updated at different times, their revision numbers are not in synch. You will need to check the revision history at [http::cvs.tekkotsu.org cvs.tekkotsu.org] to find the revision number you want. You can find the current revision number of a file with the cvs status command, e.g.:

cvs status Point.h

Let's say the current revision number is 1.27 and you want to revert back to revision 1.25. You can do that by typing:

cvs update -r1.25 Point.h

After giving this command, you can use cvs status to verify the file's revision number, and you will see that it is marked with a "sticky tag" of 1.25. Normally this would mean that the file will stay at revision 1.25 until you explicitly clear the sticky tag. However, Tekkotsu's recommended .cvsrc file is set up to clear sticky tags by default, so the next cvs update will put the file back at the latest revision. To prevent this, you can override the .cvsrc file when you update the directory by doing:

cvs -f update

Clearing Sticky Tags

As mentioned in the previous section, Tekkotsu's recommended .cvsrc file automatically clears sticky tags, so if you want to return to the latest revision of a file, all you need to do is a cvs update. However, if you are not using this .cvsrc file, any sticky tag attached to a file will persist until removed. To clear the sticky tags attached to a file, use the -A flag with cvs update:

cvs update -A Point.h

Notice that the -f flag used in the preceding section appeared before the update command, while the -A flag must appear after the update command. That is because -f is a global option, while the -A flag is specific to the update command.