Concurrent Versions System
HOWTO: Use the RCVS Script to Manipulate the PC Master Repository
By Joshua T. Hogle
- 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.
In order to use this script, the following requirements must be met:
- The system on which the script is running must have Windows Script Host version 5.6 or later installed on it.
- The user must have permissions to access and manipulate the CVS repository files.
- 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.
The rcvs.wsf script is located in the S:\tools\usr\local\bin folder.
rcvs [options] <action> <object> [object] ...
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.
- Start a Command Prompt by going to Start and choosing Run. In the Open field enter cmd.exe.
- Go to the folder S:\masters\sms\pkg\<site> where <site> is the folder corresponding to your site.
- Create a new folder called CVSTUTOR.
- Add that folder to CVS by typing rcvs add CVSTUTOR. Change into the CVSTUTOR folder.
- 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.
- Add the file TUTOR1.TXT to CVS by typing rcvs add TUTOR1.TXT.
- 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.
- 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.
- Check out TUTOR1.TXT from CVS by typing rcvs co TUTOR1.TXT.
- 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.
- Temporarily change your user ID to bliga by typing SET USERNAME=bliga at the prompt.
- 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.
- Change your ID back by typing SET USERNAME=<your login> where <your login> is your login name.
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
- Save the file and exit the text editor.
- 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.
- 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.
- Check out TUTOR2.TXT by typing rcvs co TUTOR2.TXT.
- 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.
- Change to the parent directory and remove the CVSTUTOR directory by typing rcvs remove CVSTUTOR.
Last modified: 2014/06/18 17:03:55.598195 GMT-4 by
Created: 2007/12/05 10:54:18.241000 US/Eastern by adam.m.gallick.1.
Type in a few keywords describing what information you are looking for in the text box below.