Version Control Rocks
One thing I forgot to mention when I was ranting about grid.optimize, is that version control rocks. Toni and I were sort of late adapters of version control, but it amazes me how many developers still don't use it. I used to be one of them. I was stupid.
Looking at a Diff of the cContrls class library is what got me looking into the optimize property. Troy, the customer who encountered this problem, had already told me that it doesn't occur with our August release of VFE. We've checked in changes to this class library over a dozen times since August, but I was able to view a Diff between the current version and the August release and easily identify the change. Without version control, this change history would've been lost or taken a helluva lot more time to dig up and wade through.
One of the things that made this easy was that Toni and I create VCA files for all class libraries at the time of check in. I work on a project where most of the other developers don't and it sucks. It takes about a second to make a VCA file, but if you don't make them at the time of check in, then you have to make a VCA file for the file you're working with, copy it off somewhere, get the class library for the version you want to compare to from source control, then make the VCA for it. If you've got changes you don't want to check in you also have to copy them out to another location first. By the time you're finished with all of the copying you've usually forgot what you were going to look for, so it's best just to make the VCA files all of the time.
BTW, we used a revised version of SCCTEXT to get around some of its limitations. For more info, check out the SCCTEXT topic on the wiki.
I have a little PRG I use to make my VCA files, so I don't have to do it manually for each VCX file I have checked out. (SCX's are for sissies, but you can add support to it for them easyily enough.) Here it is:
*==============================================================================
* Procedure: VCAAll
* Purpose: Makes a .VCA file for every VCX file that is missing one
* in a directory and for every existing VCA file that's not
* readonly.
* Also packs .VCX file first so that smaller files can be
* checked in and checked out.
* Author: F1 Technologies
* Parameters: None
* Returns: None
* Added: 01/20/2006
*==============================================================================
LOCAL ;
lcDirectory, ;
lnI, ;
lcVCA, ;
lcClassLib, ;
llGen
LOCAL ARRAY laFiles[1]
lcDirectory = ADDBS(GETDIR())
FOR lnI = 1 TO ADIR(laFiles,lcDirectory + [*.VCX])
lcVCA = lcDirectory + JUSTSTEM(laFiles[lnI,1]) + [.VCA]
DO CASE
CASE NOT FILE(lcVCA)
llGen = .T.
CASE NOT [R] $ laFiles[lnI,5] && VCA is not readonly, assume checked out.
llGen = .T.
OTHERWISE
llGen = .F.
ENDCASE
IF llGen
lcClassLib = lcDirectory + laFiles[lnI,1]
CLEAR CLASSLIB (lcClassLib)
USE (lcClassLib) EXCLUSIVE ALIAS ClassLib
TRY
PACK
USE IN CLASSLIB
DO (_SCCTEXT) WITH lcClassLib
CATCH
ENDTRY
IF LASTKEY()=27
EXIT
ENDIF
ENDIF
NEXT
I hang this program off of my utilities menu and when I'm ready to check files in to version control I just run it on the directory I'm working on. I'd be easy enough to make it walk several directories, but I really haven't had a need for it.
Enjoy, and let me know if you improve on it.
4 Comments:
Hi Alex,
Yeah, I don't use the VFP integration, so I do end up generating the VCA files manually. Since I've got the utility to generate all of the ones I need it doesn't slow me down much.
We use Source Off Site (which uses VSS as its back-end) in-house and SourceGear Vault on another project. I recall seeing an option for a post check-in executable in one of the UI's at some point. I've always meant to write something to do the VCA files automatically at that time, but have never gotten around to it.
Hi Mike,
just as a backup for your choice: we here at ProLib also use VAULT for all projects. The good thing about VAULT is, that it doesn't use the MS Sourcesafe "database", which is basically thousands of textfiles in bazillions of subdirectories. Vault is based on SQLServer, and since we use it, we never had any problem with Sourcecontrol.
BTW: Thanks for the pointer to "our" pl_Scctext.prg ;)
wOOdy
No problem wOOdy, everyone likes their error messages in German.
Just a further note,Mike - I do something similar but it checks for date/time stamps and goes into subfolders.
That way, if I have a folder with 100 classes but only one has been updated - it only updates one of them.
Post a Comment
<< Home