CEN4020: Software Engineering I up↑

CVS Instructions

These are notes originally produced for the Linux kernel and device driver course, supplemented with some personal notes by student Mark Stanovich. A more polished introduction to CVS can be found at the SCS website http://sc.fsu.edu/computing/tech-docs/226-cvs-information.

By the way, support for CVS is built into the Eclipse IDE. See http://www.ibm.com/developerworks/library/os-ecshare/ for an article on this.

Notes from the Kernel & Device Driver Programming Course

The following instructions mostly assume you are working from linprog.cs.fsu.edu with username your_id.

Step A: Initializing the CVS: (one time step)

  1. Log into linprog.cs.fsu.edu, or whatever other system you will be using to hold the working copies of your files.

  2. Execute 'mkdir CVSROOT' in your home directory.

  3. Assuming that you are using bash shell, open the .bashrc file and add the following line somewhere in the file:

    export CVSROOT=/home/grads/<your_userid>/CVSROOT
    where <your_userid> is your userid in the computer science department servers. (If there already is another CVSROOT variable exported, the please comment it out by inserting the # symbol in front of it.)

  4. Execute 'source ~/.bashrc'

  5. Execute 'cvs init'

  6. Now your cvs environment is initialized on department servers.

*BIG FAT WARNING*: Never ever modify the files inside the cvsroot directory manually. These files have version tags that only the CVS software understands. If you change it yourself, the repository gets corrupted.

Step B: Creating a new repository: (one-time step)

  1. Log into the machine where you have a copy of the source code that you want to check in. For example, if your source code is on device12.cs.fsu.edu then log into device12.cs.fsu.edu.

  2. Assuming that you are using bash shell, open the .bashrc file and add the following two lines somewhere in the file.

         export CVSROOT=:ext:<your_userid>@linprog:/home/grads/<your_userid>/CVSROOT
         export CVS_RSH=ssh
    where <your_userid> is your userid in the computer science department servers. (If there already are other CVSROOT and CVS_RSH variables exported, then please comment them out by inserting the # symbol in front of them.)

  3. Execute

    source ~/.bashrc
  4. Assume that your source code located is in a directory named my_projects/. Execute

    cd my_projects/

    (replace my_projects with the name of your working directory).

  5. Execute

    cvs import my_projects "init" "v1"

    When prompted for password, please enter the CS department password.

    This command will create a cvs repository named my_projects in the CS department server and import all the files in the current directory to the server.

    You can replace my_projects with whatever other name you wish to choose.

  6. Now your source code is imported into the CVS repository

Step C: Checking out your source code (one time step)

Do this whenever you want to check out a local copy of the source code from scratch from the department servers.

  1. Log into the machine where you want to work with your source code (e.g. device12.cs.fsu.edu)

  2. Rename your original my_projects directory to something else. (don't delete it until you successfully check out another copy from the department servers).

  3. Execute

           cvs co my_projects

    Enter your password when prompted. This command will check out a local copy of your source code repository from the department server.

    You will notice that the checked out directory my_projects/ has a subdirectory named CVS/. So does every other subdirectory under my_projects. This is CVS specific information. *NEVER* change the contents of this directory manually yourself.

Step D: Working with CVS (repetitive step each time you work on source code)

  1. Whenever you want to work on your source code, make changes to the local copy you checked out using step C above. Local copy means the copy you checked out on your work machine (e.g. device12.cs.fsu.edu)

  2. When you are done making changes, cd to the 'my_projects' directory.

  3. Execute

           cvs update

    You will see a bunch of messages with different tags against different files you have modified as CVS tries to merge the files you changed. Watch the messages for any conflict warnings. Conflicts mean that the changes you made and the copy in the repository are no consistent. Open the local files that report a conflict. You will see CVS tags inside the files that indicates where CVS has found conflicts. Resolve these conflicts manually by deleting the parts that seem old or incorrect. (Hopefully you'll rarely have to resolve conflicts).

  4. Execute

           cvs commit -m ""

    where is an informative message you want to add to the version of the source you are committing in.

  5. Now your changes to your source code are committed into the department servers. Do this each time you change your source code -- normally at least one every day and each time you make significant changes that are known to be stable.

Mark Stanovich's Notes

The following notes are from CS student, Mark Stanovich, explaining how he uses CVS.

Starting a Project

cvs import project_directory_location vendor start

Listing modules

  • cvs rls
  • Checking in files

    cvs commit

    Adding files and directories

    cvs add directory_or_filename

    Take care to do cvs commit after.

    The following are useful for adding an entire directory to a CVS repository.

    find . -type d -print | grep -v CVS | xargs -I{} cvs add {}
    find . -type f -print | grep -v CVS | xargs -I{} cvs add {}

    This can be done as a single line, also:

    find . -type d -print | grep -v CVS | xargs -I{} cvs add {}; find . -type f -print | grep -v CVS | xargs -I{} cvs add {}

    Removing "CVS" files

    find . -name "CVS" -exec rm -r {} \;

    List files that will be added or merged or do not correspond to anything in the source repository.

    (cvs update -d 2>&1) | grep -v '^cvs update: Updating'

    This only works with the bash shell.

    Checking out to a directory other than the project name

    cvs co -d new_dir project_name

    Adding a user

    cvsd-passwd /var/lib/cvsd/root USER_NAME

    Then add the user to one of the following:

    /var/lib/cvsd/root/CVSROOT/readers
    /var/lib/cvsd/root/CVSROOT/writers

    If the user is in readers, then the user will only have read access even if the user is in the writers file.

    Removing files

    Removing sticky flag(s)

    cvs update -A

    A makefile with cvs update embedded:

    cvs : make new make clean cvs update cvs commit new : make clean make clean : rm -rf

    Ownership of CVS repository

    To change group ownership:

    chgrp -R group_name /var/lib/cvsrepository

    New directories will still have the default group ownership of the user that creates them. To give all directories the group owner use the setgid bit.

    chmod g+s /var/lib/cvsrepository
    chmod g+s /var/lib/cvsrepository/CVSROOT

    Option "-d" to get new directories with CVS "update" command:

    Create any directories that exist in the repository if they're missing from the working directory. Normally, update acts only on directories and files that were already enrolled in your working directory.
    This is useful for updating directories that were created in the repository since the initial checkout; but it has an unfortunate side effect. If you deliberately avoided certain directories in the repository when you created your working directory (either through use of a module name or by listing explicitly the files and directo- ries you wanted on the command line), then updating with -d will cre- ate those directories, which may not be what you want.

    CVS References

    You can find many other such reference using a search engine.

    Other Versioning Software

    ($Id)