The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации

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 until you become very familiar with the CVS commands. The scripts are written for Korn shell since it is always available on all flavors of Unix, but you can translate to bash or Perl if needed. You can customize these scripts to your taste. They are basically CVS commands, but features are added to make it site specific. For example, the sedit script provides locking so that users will know someone is editing the file. Of course users can directly use the CVS commands to bypass these scripts. These scripts demonstrate how CVS can be customized to a great extent.

NOTE: The wrapper shell scripts assume 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 these 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 downloadsoftware to get this.
  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 check it out. Of course you can change the script to your requirement - make no locking, warning message, or very strong locking. Click downloadsoftware to get this.
  3. scommit [-r revision_number] <filename> To commit the changes you made to filename or entire directory. Upload your changes to CVS. Click downloadsoftware to get this.
  4. supdate <filename/directory> To update a filename or to update an entire directory by getting the latest files from CVS. Click downloadsoftware to get this.
  5. sunlock [-r revision_number] <filename> To unlock the file got by sedit. Will release the lock. Click downloadsoftware to get this.
  6. slist To see the list of files currently being edited by you. Does 'ls -l | grep | ...' command. Click downloadsoftware to get this. Note that there is also another Unix command by the 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 downloadsoftware to get this.
  8. slog <filename> To get the history of changes/revisions to a file from CVS. Click downloadsoftware to get this.
  9. sdif <filename>

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

    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 downloadsoftware to get this.
  11. sdelete <filename> To delete a file from CVS repository. Click downloadsoftware to get this.
  12. sfreeze <revision name> <directory name> To freeze the code, that is make a release of the entire source tree. Click downloadsoftware to get this.

    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 the revision name.

Next Previous Contents

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2023 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру