Next Previous Contents

6. Shell Scripts

The following are wrappers around the basic CVS commands. These scripts give you initial booster-push into the CVS system and are useful untill you become very familiar with the CVS commands. The scripts are written for Korn shell since korn shell is always available on all flavors of unixes, but you can translate to bash or PERL if needed. You can customize these scrips to your taste. They are basically CVS commands but features are added to make it site specific. For example, sedit script provides locking so that users will know some-one is editing the file. Of course users can directly use the CVS commands to by-pass these scripts. These scripts demonstrate how CVS can be customized to a great extent.

NOTE: The wrapper shell scripts assume that the user's home directory as the root and check out the tree from cvs to build the tree underneath user's home directory.

TIP: In shell scripts, every target filename is composed of 3 parts - Home directory, sub-directory and the filename. The full-path is $HOME/$subdir/$fname And in CVS the same directory structure is maintained (by variable $subdir) therefore in cvs there will be something like $CVSROOT/$subdir/$fname. In all scripts, these 4 variables $HOME, $CVSROOT, $subdir and $fname play an important role. For example, sample values can be like HOME=/home/aldev, subdir=myproject/src CVSROOT=/home/cvsroot and fname=foo.cpp

Copy these scripts to /usr/local/bin and this should be in the user's PATH environment.

  1. sget [-r revision_number] <file/directory name> To get a file or entire directory from CVS in READ ONLY mode. Click sget
  2. sedit [-r revision_number] <filename> To edit a file in order to make changes to code. This will lock the file so that nobody else can checkout. Ofcourse you can change the script to your requirement - make no locking, warning message or very strong locking. Click sedit
  3. scommit [-r revision_number] <filename> To commit the changes you made to filename or entire directory. Upload your changes to CVS Click scommit
  4. supdate <filename/directory> To update a filename or to update an entire directory by getting the latest files from CVS Click supdate
  5. sunlock [-r revision_number] <filename> To unlock the file got by sedit. Will release the lock. Click sunlock
  6. slist To see the list of files currently being edited by you. Does 'ls -l | grep | ...' command. Click slist . Note that there is also another unix command by name slist (list available Netware servers), you should make sure cvs script slist comes before other in your PATH environment.
  7. sinfo <filename/directory> To get the information of changes/revisions to a file Click sinfo
  8. slog <filename> To get the history of changes/revisions to a file from CVS Click slog
  9. sdif <filename>

    sdif -r rev1 -r rev2 <filename> To get the diff of your file with CVS. Click sdif

    NOTE: sdif has only one 'f' because there is already another unix command called 'sdiff'

  10. sadd <filename> To add a new file to CVS repository Click sadd
  11. sdelete <filename> To delete a file from CVS repository Click sdelete
  12. sfreeze <revision name> <directory name> To freeze the code, that is make release of entire source tree. Click sfreeze

    For example :


            cd $HOME;   
            sfreeze REVISION_1_0  srctree  
    

    This will freeze code with tag REVISION_1_0 so that you can later checkout the entire tree by using with revision name

                ******************************************************


Next Previous Contents