CvsDiff

From Pickwiki
Jump to navigationJump to search

HomePage >> BasicSource >> TclStack

A helper program to show diffs between working version and CVS version

SUBROUTINE CVS.DIFF(RTN,FILE,ITEM,OPTIONS)
***************************************************************************
* Program: CVS.DIFF
* Author : $mcgowan
* Date   : 11/08/2002
* Edited : 17:32:31 Nov 08 2002 By MCGOWAN 
* Comment: Do a diff, basically same as checkout
***************************************************************************
*$Log: CVS.DIFF,v $
*Revision 1.3  2003/04/10 03:41:20  dsiroot
*mcgowan:Show working version vs. cvs version
*
*Revision 1.2  2003/04/10 02:37:22  dsiroot
*mcgowan:Return an error flag of -1
*
*Revision 1.1  2002/11/12 09:38:40  dsiroot
*Auto Checkin
*
*Revision 1.1  2002/11/09 01:46:25  mcgowan
*Checkin
*

RTN=''
CALL CVS.STATUS(STATUS.RTN,FILE,ITEM,'')
STATUS=STATUS.RTN<1>
WORK.VER=STATUS.RTN<2>
CVS.VER=STATUS.RTN<3>

IF STATUS='NOTINCVS' THEN
   IF OPTIONS<1>='SHOW' THEN
      PRINT ITEM:' not in cvs'
   END
   RTN=-1
   RETURN
END

IF WORK.VER # CVS.VER THEN
    IF OPTIONS<1>='SHOW' THEN
        PRINT 'Working version=':WORK.VER:', CVS=':CVS.VER
    END
END

CALL CVS.GETDIR(DIR,FILE)

E=\!cd \:DIR:\;cvs diff \:ITEM
EXECUTE E CAPTURING RTN
IF RTN = '' THEN
   IF OPTIONS<1>='SHOW' THEN
      PRINT 'Working version matches cvs'
   END
END ELSE
   IF OPTIONS<1>='SHOW' THEN
      I=DCOUNT(RTN,@AM)
      FOR F=1 TO I; PRINT RTN<F>; NEXT F
   END
END
RETURN