CvsStatus

From Pickwiki
Jump to navigationJump to search

HomePage >> BasicSource >> TclStack

A helper program to get the status of a program in CVS

SUBROUTINE CVS.STATUS(RTN,FILE,ITEM,OPTIONS)
***************************************************************************
* Program: CVS.STATUS
* Author : $mcgowan
* Date   : 11/08/2002
* Edited : 17:53:15 Nov 08 2002 By MCGOWAN 
* Comment: 
***************************************************************************
* $Id: CVS.STATUS,v 1.10 2003/10/02 22:00:51 dsiroot Exp $

* $Log: CVS.STATUS,v $
* Revision 1.10  2003/10/02 22:00:51  dsiroot
* mcgowan:Add 'locally added' to list of statuses
*
* Revision 1.9  2003/04/30 19:08:12  dsiroot
* mcgowan:Add unresolved conflict to list of statuses
*
* Revision 1.8  2003/04/11 23:00:46  dsiroot
* mcgowan:Add Needs Merge to list of statuses
*
* Revision 1.7  2003/04/11 22:59:19  dsiroot
* mcgowan:Return WORK.REV for locally modified programs
*
* Revision 1.6  2003/04/10 17:51:49  dsiroot
* mcgowan:Add Needs Checkout to list of statuses
*
* Revision 1.5  2003/04/10 17:40:24  dsiroot
* mcgowan:Redirect stderr for cvs status command
*
* Revision 1.4  2003/04/10 03:45:52  dsiroot
* mcgowan:Don't be verbose
*
* Revision 1.3  2003/04/10 03:20:09  dsiroot
* mcgowan:Add work and cvs rev number
*
* Revision 1.2  2003/04/10 02:14:29  dsiroot
* mcgowan:Add needs patch to list of updated statuses
*

CALL CVS.GETDIR(DIR,FILE)
IF DIR='ZZZ' THEN RTN='NOSTATUS';RETURN

E=\!cd \:DIR:\;\
E:=\cvs status \:ITEM:\ 2>/dev/null | \
E:=\awk '[[/Status]]:/ {print} [[/Working]] revision:/ {print $3} [[/Repository]] revision:/ {print $3}' \
E:=\2>/dev/null\
EXECUTE E CAPTURING OUTPUT
STATUS=OUTPUT<1>
WORK.REV=OUTPUT<2>
CVS.REV=OUTPUT<3>

BEGIN CASE
   CASE INDEX(STATUS,"Unknown",1)
      RTN='NOTINCVS'
   CASE INDEX(STATUS,"Up-to-date",1)
      RTN='UPTODATE'
      RTN<2>=WORK.REV
      RTN<3>=CVS.REV
   CASE INDEX(STATUS,"Locally Added",1) OR INDEX(STATUS,"Locally Modified",1) OR INDEX(STATUS,"Needs Patch",1) OR INDEX(STATUS,"Needs Checkout",1) OR INDEX(STATUS,"Needs Merge",1) OR INDEX(STATUS,"Unresolved Conflict",1)
      RTN='MODIFIED'
      RTN<2>=WORK.REV
      RTN<3>=CVS.REV
   CASE 1
      RTN='NOSTATUS'
      PRINT OUTPUT
END CASE
RETURN