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 |
my $exists_name = "CVS"; |
20 |
$exists_name = "$name/$exists_name" if $name; |
21 |
if (! -e $exists_name || ($option && $option eq 'checkout')) { |
22 |
$cvscmd = 'checkout'; |
23 |
$shellcmd = "cvs -d /var/lib/cvs $cvscmd -d $name $which"; |
24 |
} else { |
25 |
$cvscmd = 'update'; |
26 |
$shellcmd = "cvs -d /var/lib/cvs $cvscmd $name"; |
27 |
} |
28 |
return if !$shellcmd; |
29 |
#print "cmd: $shellcmd", "\n"; |
30 |
run_cmd($shellcmd); |
31 |
} |
32 |
|
33 |
synccvs(shift, shift, shift); |
34 |
|
35 |
1; |