Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Proceed if cvs was updated..."



I have a script that currently starts by deleting 2 files in a given 
directory, then doing a cvs update on those files to get the freshest 
copy.  Those files are critical to proper running of my script.

The thing is there's no brain to determine that during that update it's 
really getting the most recent version of the files (which are being 
checked in by a different job).  So it could be deleted the old ones and 
bringing them back again and never know it.  We can assume that the two 
files are always updated as a set, there will never be a case when one is 
updated and the other is not.

I'd like to change the script to say "If the version in CVS is new for 
these files, then get the new version and continue, otherwise exit."

One way is is to use "cvs -n update file1 file2" which will display 
something like this:

U file1
P file2

meaning that file1 has been updated, and file2 has been "patched" (a
variation on update).  I could grep the output for lines that start with U
or P and if there's more than 0, then I have new files, so go ahead and
issue a real update command.  Of course I'd have to do this while the
current local copies still exist, otherwise they would always be updated.

Is there a better one? I was hoping that maybe I could use a return value 
from CVS, maybe it returns a 0 if there's nothing to update or something, 
but no such luck.  I wish that "cvs status" had more usefulness but it's 
output is so big and fat that it's hard to scrape out the one little bit I 
need.

Duane








BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org