Print this article Edit this article

Concurrent Versions System

CVS

HOWTO: Use the RCVS Script to Manipulate the PC Master Repository

By Joshua T. Hogle


Applies To

  • Windows 2000 Professional
  • Windows 2000 Server
  • Windows 2000 Advanced Server
  • Windows XP Professional

An Overview of RCVS

RCVS is a wrapper script to CVS, the Concurrent Versions System, to make it work more like RCS, the Revision Control System. Both RCS and CVS provide version control for tracking changes to files over a period of time. Typically, CVS is used in a project-oriented environment where many people can be working on the same file at the same time. However, because of the nature of the manner in which ECN has setup SMS for use with software deployment and package management, we need a more RCS-like system where only one person can work on a file in a central location at any given time.

So why not just use RCS? The problem with RCS is that it does not support tracking changes to binary files. Because binary file support was necessary, an alternative, CVS, had to be used. RCVS attempts to handle the details of CVS activities for you.


Why You Should Use RCVS

When utilities such as SyMON initially setup a folder to hold a software package's files, it places the initial files it creates under CVS control. Other files and folders can be added to CVS control as well, however, you are not required to add anything to CVS.

Why should you keep things under CVS control? CVS and RCS both are useful utilities for backing out a change to a file that may have resulted in something breaking. PictureTaker change files are especially notorious since any changes made to the files are made in real-time. There is no save option and there is no undo option. So, if you accidentally make a change to one of these files, it's automatically committed for you. If, however, you have the file under CVS control, you can check out another version that was a working version and "undo" the changes.

Another benefit of adding files to CVS is that you guarantee that no 2 people will be making changes to the same file at the same time. In some cases, there's only one person that would ever touch a given file. However, in other cases, such as ECN central staff, several people share in managing packages. When a file is under CVS control, only one of these people can be editing that file at one time. This ensures that no one's changes are lost because two people wrote different contents to the same file at the same time.

NOTE:
Currently, no two people can have a file checked out of the CVS repository for editing at the same time. However, this does not necessarily mean that the person who has the file checked out is the only person who can write to it. NTFS permissions on a file are not changed when it is checked out, so the file may be edited by multiple people. However, if proper technique is followed and people try to check files out before editing them, this problem should be avoided. A future release of RCVS may address this problem.

Prerequisites

In order to use this script, the following requirements must be met:

  1. The system on which the script is running must have Windows Script Host version 5.6 or later installed on it.
  2. The user must have permissions to access and manipulate the CVS repository files.
  3. The user must have S: mapped to \\ohare.ecn.purdue.edu\public.

For more information on these prerequisites, see the links referenced at the bottom of this document.


Usage

The rcvs.wsf script is located in the S:\tools\usr\local\bin folder.

rcvs [options] <action> <object> [object] ...

where options is any global option specified in Table 1, action is any action specified in Table 2, and object is the name of a file or directory to work with.

Option Description
--comment=<comment> Sets the comment for a file when it is being checked in or added to CVS.

When a new file is added to CVS, its initial comment is set to Initial Revision. When a file is checked in after changes are made, and no comment is specified, the comment must be entered in the default editor.

Example:
--comment="I made a change"
--help Displays a general help and usage screen
--quit-on-error RCVS can operate on multiple files or folders at one time. If this option is specified and an error occurs at any time, the entire operation is aborted. By default, it will continue on the next file or folder even if an error occurs on a previous file.
--revision=<rev> Specifies a particular revision of a file to check out from the CVS repository.
--revision=1.2
Table 1: Global RCVS options
NOTE:
Options are case-sensitive.

You can specify a single file or folder to operate on, or you can specify multiple files and/or folders by separating them by a space. Some example command lines are given below:

rcvs add this_folder
rcvs add this_file that_file the_other_file
rcvs co this_file
rcvs ci \\server\share\folder1\file

RCVS is mainly used to manipulate files by checking them into and out of a central library via the ci and co commands, respectively. Initially, the file must be added to CVS control via the add action. However, before any files in a particular folder can be added to CVS, that folder which contains the files must be added to CVS. A folder is initially put under CVS control with a special set of commands which are outside the scope of this document.

When you remove a file from CVS control, it is not removed from the disk. Instead, it is placed into a special subfolder, CVS\Archives, and renamed with a .# extension where # is the copy number of the file. For example, if you remove the file setup.wsf, it will be moved into the folder and renamed setup.wsf.0. There are no commands to purge the archives other than just to delete the files themselves.


RCVS Quick Tutorial

Now that the basics of CVS have been covered, it's time to do a short practice using RCVS. Follow the steps below and make sure that you get the expected output.

NOTE:
It is assumed you have added the S:\tools\usr\local\bin directory to your path. If you have not, replace any occurrence of rcvs with S:\tools\usr\local\bin\rcvs.
  1. Start a Command Prompt by going to Start and choosing Run. In the Open field enter cmd.exe.
  2. Go to the folder S:\masters\sms\pkg\<site> where <site> is the folder corresponding to your site.
  3. Create a new folder called CVSTUTOR.
  4. Add that folder to CVS by typing rcvs add CVSTUTOR. Change into the CVSTUTOR folder.
  5. Create 3 new files called TUTOR1.TXT, TUTOR2.TXT, and TUTOR3.TXT with any content you desire. Also copy the file "%SystemRoot%\system32\cmd.exe" to the folder.
  6. Add the file TUTOR1.TXT to CVS by typing rcvs add TUTOR1.TXT.
  7. Add the remaining files to CVS by typing rcvs add TUTOR2.TXT TUTOR3.TXT *.exe. Notice that file names may contain wildcard characters such as the * and ?. This applies for any of the RCVS commands.
  8. Try adding the files to CVS again by typing rcvs add TUTOR?.TXT *.exe. Notice that you receive an error telling you the files are already under CVS control.
  9. Check out TUTOR1.TXT from CVS by typing rcvs co TUTOR1.TXT.
  10. Check the status of all of the files by typing rcvs status *.*. Notice that the TUTOR1.TXT file shows up as being locked by you.
  11. Temporarily change your user ID to bliga by typing SET USERNAME=bliga at the prompt.
  12. Try checking out TUTOR1.TXT now. You should see a message stating that it's already locked by another user, you. CVS uses the USERNAME and USERDOMAIN environment variables to determine your login when locking a file. You should be aware of this.
  13. Change your ID back by typing SET USERNAME=<your login> where <your login> is your login name.
  14. Open the TUTOR1.TXT file using a text editor such as Notepad. Add the following lines to it:
       # This is a comment line
    #
    # $Id$
    #
    # $Log$

    This is some data
  15. Save the file and exit the text editor.
  16. Check the file back into CVS by typing rcvs ci TUTOR1.TXT. You will be prompted to enter a comment using the vi editor. If you want to specify the comment on the command-line instead, use the --comment option. You can set the comment to whatever you like. If you are specifying it on the command line, and it contains spaces, you should surround it with double quotes.
  17. Now view the contents of the file by typing type TUTOR1.TXT. Notice that the lines containing $Id$ and $Log$ have been changed and expanded to include additional data. These two lines are CVS keyword lines. Any time CVS sees either of them, it will automatically expand them for you when you check the file into the library.
  18. Check out TUTOR2.TXT by typing rcvs co TUTOR2.TXT.
  19. Open it with a text editor and add some data to it and save it. Instead of checking it back in, however, simply unlock the file by typing rcvs unlock TUTOR2.TXT. Notice that the modified version is archived and the original copy from the CVS library is retrieved.
  20. Change to the parent directory and remove the CVSTUTOR directory by typing rcvs remove CVSTUTOR.

Last Modified: Dec 19, 2016 11:12 am US/Eastern
Created: Dec 5, 2007 10:54 am US/Eastern by admin
JumpURL: