| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
# synccvs - checkout / update from cvs made easy |
| 4 |
# $Id$ |
| 5 |
|
| 6 |
use strict; |
| 7 |
use warnings; |
| 8 |
|
| 9 |
my $cvs = '/usr/bin/cvs -q'; |
| 10 |
my $CVSROOT = '/var/lib/cvs'; |
| 11 |
|
| 12 |
sub synccvs { |
| 13 |
my $which = shift; |
| 14 |
my $name = shift; |
| 15 |
my $option = shift; |
| 16 |
|
| 17 |
$which =~ m/^.*\/(.+?)$/; |
| 18 |
$name ||= $1; |
| 19 |
|
| 20 |
my $shellcmd; |
| 21 |
my $cvscmd; |
| 22 |
my $exists_name = "CVS"; |
| 23 |
$exists_name = "$name/$exists_name" if $name; |
| 24 |
if (! -e $exists_name || ($option && $option eq 'checkout')) { |
| 25 |
$cvscmd = 'checkout'; |
| 26 |
$shellcmd = "$cvs -d $CVSROOT $cvscmd -d $name $which"; |
| 27 |
} else { |
| 28 |
$cvscmd = 'update'; |
| 29 |
$shellcmd = "$cvs -d $CVSROOT $cvscmd -d $name"; |
| 30 |
} |
| 31 |
return if !$shellcmd; |
| 32 |
#print "cmd: $shellcmd", "\n"; |
| 33 |
system($shellcmd); |
| 34 |
} |
| 35 |
|
| 36 |
synccvs(shift, shift, shift); |
| 37 |
|
| 38 |
1; |