| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use lib qw( /data/libs/nfo/perl/libs ); |
| 7 |
use org::netfrag::shortcuts qw( run_cmd ); |
| 8 |
|
| 9 |
sub synccvs { |
| 10 |
my $which = shift; |
| 11 |
my $name = shift; |
| 12 |
my $option = shift; |
| 13 |
|
| 14 |
$which =~ m/^.*\/(.+?)$/; |
| 15 |
$name ||= $1; |
| 16 |
|
| 17 |
my $shellcmd; |
| 18 |
my $cvscmd; |
| 19 |
if (! -e $name || ($option && $option eq 'checkout')) { |
| 20 |
$cvscmd = 'checkout'; |
| 21 |
$shellcmd = "cvs -d /var/lib/cvs $cvscmd -d $name $which"; |
| 22 |
} else { |
| 23 |
$cvscmd = 'update'; |
| 24 |
$shellcmd = "cvs -d /var/lib/cvs $cvscmd $name"; |
| 25 |
} |
| 26 |
return if !$shellcmd; |
| 27 |
#print "cmd: $shellcmd", "\n"; |
| 28 |
run_cmd($shellcmd); |
| 29 |
} |
| 30 |
|
| 31 |
synccvs(shift, shift, shift); |
| 32 |
|
| 33 |
1; |