| 1 |
root |
1.1 |
#!/usr/bin/perl |
| 2 |
|
|
|
| 3 |
bd |
1.4 |
# synccvs - checkout / update from cvs made easy |
| 4 |
|
|
# $Id$ |
| 5 |
|
|
|
| 6 |
root |
1.1 |
use strict; |
| 7 |
|
|
use warnings; |
| 8 |
|
|
|
| 9 |
bd |
1.4 |
my $cvs = '/usr/bin/cvs -q'; |
| 10 |
|
|
my $CVSROOT = '/var/lib/cvs'; |
| 11 |
root |
1.1 |
|
| 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 |
root |
1.3 |
my $exists_name = "CVS"; |
| 23 |
|
|
$exists_name = "$name/$exists_name" if $name; |
| 24 |
|
|
if (! -e $exists_name || ($option && $option eq 'checkout')) { |
| 25 |
root |
1.1 |
$cvscmd = 'checkout'; |
| 26 |
bd |
1.4 |
$shellcmd = "$cvs -d $CVSROOT $cvscmd -d $name $which"; |
| 27 |
root |
1.1 |
} else { |
| 28 |
|
|
$cvscmd = 'update'; |
| 29 |
bd |
1.4 |
$shellcmd = "$cvs -d $CVSROOT $cvscmd -d $name"; |
| 30 |
root |
1.1 |
} |
| 31 |
|
|
return if !$shellcmd; |
| 32 |
|
|
#print "cmd: $shellcmd", "\n"; |
| 33 |
bd |
1.4 |
system($shellcmd); |
| 34 |
root |
1.1 |
} |
| 35 |
|
|
|
| 36 |
|
|
synccvs(shift, shift, shift); |
| 37 |
|
|
|
| 38 |
|
|
1; |