"Proceed if cvs was updated..."

Derek Atkins warlord at MIT.EDU
Tue Feb 3 11:41:50 EST 2004


I'd also suggest using "cvs update -C" instead of "rm; cvs update"
to pull down new versions of the files.

I don't know if there is any better way than looking at the output of
cvs.  I don't know if there is a usable return value.

-derek

Duane Morin <dmorin at lear.morinfamily.com> writes:

> 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
>
>
>
>
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://www.blu.org/mailman/listinfo/discuss
>
>

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the Discuss mailing list