CvsCheckin

From Pickwiki
Jump to: navigation, search

HomePage >> BasicSource >> TclStack

A helper program to check programs in to CVS

SUBROUTINE CVS.CHECKIN(RTN, FILE, ITEM, OPTIONS)
***************************************************************************
* Program: CVS.CHECKIN
* Author : $Author: dsiroot $
* Date   : 11/08/2002
* Edited : $Id: CVS.CHECKIN,v 1.7 2003/10/02 22:02:08 dsiroot Exp $
* Comment:
***************************************************************************
*$Log: CVS.CHECKIN,v $
*Revision 1.7  2003/10/02 22:02:08  dsiroot
*mcgowan:Do not allow double quotes in checkin message
*
*Revision 1.6  2003/04/10 03:30:58  dsiroot
*mcgowan:Change CVS.STATUS return params
*
*Revision 1.5  2002/12/18 17:32:34  dsiroot
*mcgowan:Supress screen output if auto checkin
*
*Revision 1.4  2002/11/12 09:46:39  dsiroot
*Auto Checkin
*
*Revision 1.3  2002/11/12 08:27:09  dsiroot
*dsiroot:Fix heading, use : rather than -
*
*Revision 1.2  2002/11/12 08:23:16  dsiroot
*dsiroot-Prepend user name to checkin message
*
*Revision 1.1  2002/11/12 07:44:02  dsiroot
*Add AUTO option
*
*Revision 1.0  2002/11/09 02:01:06  mcgowan
*INITIAL CHECKIN
*

IF OPTIONS<1>='AUTO' THEN AUTO=1 ELSE AUTO=0

PROMPT ''
RTN=''
CALL CVS.GETDIR(DIR,FILE)

* Decide if we need to add or commit
CALL CVS.STATUS(STATUS.RTN,FILE,ITEM,'')
STATUS=STATUS.RTN<1>
WORK.VER=STATUS.RTN<2>
CVS.VER=STATUS.RTN<3>
BEGIN CASE
   CASE STATUS='NOTINCVS'
      GOSUB ADD.IT; SLEEP 3; GOSUB COMMIT.IT
   CASE STATUS='UPTODATE'
      IF NOT(AUTO) THEN PRINT 'Already up-to-date'
   CASE STATUS='MODIFIED'
      IF NOT(AUTO) THEN CALL CVS.DIFF(DIFF.RTN,FILE,ITEM,'SHOW')
      GOSUB COMMIT.IT
   CASE 1
      PRINT 'Weird status, aborting-':STATUS
END CASE
RETURN

ADD.IT:
    E=\!cd \:DIR:\;cvs add \:ITEM
    IF NOT(AUTO) THEN PRINT E
    EXECUTE E CAPTURING OUTPUT
    IF NOT(AUTO) THEN
       I=DCOUNT(OUTPUT,@AM)
       FOR F=1 TO I; PRINT OUTPUT<F>; NEXT F
    END
RETURN

COMMIT.IT:
    IF AUTO THEN
       MSG="Auto Checkin"
    END ELSE
       PRINT "Enter short comment: ":
       INPUT MSG
       CONVERT \"\ TO \'\ IN MSG
       IF MSG = "/" OR MSG="" THEN
          PRINT "Checkin aborted" ; RETURN
       END
       MSG=@LOGNAME:":":MSG
    END
    
    E=\!cd \:DIR:\;cvs commit -m "\:MSG:\" \:ITEM
    IF NOT(AUTO) THEN PRINT E
    EXECUTE E CAPTURING OUTPUT
    IF NOT(AUTO) THEN
       I=DCOUNT(OUTPUT,@AM)
       FOR F=1 TO I; PRINT OUTPUT<F>; NEXT F
    END
RETURN