info-cvs
[Top][All Lists]
Advanced

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

up-to-date working copy


From: raptor
Subject: up-to-date working copy
Date: Fri, 5 Oct 2001 10:05:16 +0200

hi,

I've done it also in the easier way :")), see below..
As I think now, and I tried at least 5-6 different variants with
fork,exec,system,lock-files, two-scripts...etc...
main problem may be was my perl-sleep operator :"( ... (can u confirm this :
RH7.1,kernel 2.4.9,stock RH perl5.6)

#!/usr/bin/perl
#Author : raptor
use strict;
my $userName = getpwuid($<);
my $cvs = '/usr/bin/cvs';
my $repo = '/path/to/repository';
 #Don't use full path to the workcopy i.e. if your work copy is :
 # /workcopy/myproject set this to only /workcopy
my $workcopy = '/cvstest';

 #get the directory we are working on
my ($dir) = $ARGV[0] =~ /^([^\s]+?)\s/;

sub update {
    print "$userName : Updating $workcopy/$dir ...\n";
    chdir "$workcopy/$dir";
    system "(sleep 2 && $cvs -d $repo update -d -A -l) &";
    print 'ERROR: Can not start update' if $? > 0;
};

#================= MAIN
 #get the all info
undef $/;
my $msg = <STDIN>;
 #now check to see if the log message begins with '!'
unless ( $msg =~ /Log Message:.!/gs) {
    print qq{$userName : $dir
$msg
--------
    };
}# we will do our actions then
else {
 print "loginfo : -!- used will do update ASAP.....\n";
 update();
};



__END__

=head1 loginfo script

 Use this scripts so that U can have your main Development
 working copy up to date. Primary usefull for Web development.
 The script is attached as log-info script.(see: 'info cvs')

 The important thing to mention is to use cvs-update -l option
 i.e. not to recurse. Recursion is unnececary 'cause log-info
 script is fired for every directory when u commit.
 Also as u see it has to go to the background.

 Don't use perl 'sleep' it caused me problems...!!! Or use it
 and tell me if it work for U. It didn't worked for me!!!

=cut





reply via email to

[Prev in Thread] Current Thread [Next in Thread]