Cvs-Simple
view release on metacpan or search on metacpan
lib/Cvs/Simple.pm view on Meta::CPAN
$pattern = sprintf(_pattern($args[0]), @{$args[0]});
}
else {
$pattern = sprintf('-r %s', $args[0]);
}
$cmd .= $pattern;
return $self->cvs_cmd($cmd);
}
else { # Anything else is an error
croak <<SYN
Syntax: commit([rev],[\@filelist])
ci ([rev],[\@filelist])
SYN
}
}
sub ci {
goto &commit;
}
sub diff {
# Can be called as :
# diff(file_or_dir)
# diff(tag1,tag2,file_or_dir)
my($self) = shift;
my(@args) = @_;
croak "Syntax: diff(file) or diff(tag1,tag2,file)"
unless (@args && (scalar(@args)==1 || scalar(@args)==3));
my($cmd) = $self->_cmd('diff -c');
$cmd .= @args==3 ? sprintf("-r %s -r %s %s", @args)
: sprintf("%s" , @args);
return $self->cvs_cmd($cmd);
}
sub status {
# status()
# status(file1, ... )
my($self) = shift;
my(@args) = @_;
my($cmd) = $self->_cmd('status -v');
if(@args) {
$cmd .= join ' ' => @args;
}
return $self->cvs_cmd($cmd);
}
sub upd {
goto &update;
}
sub update {
# update() -> update workspace (cvs -q update -d).
# update(file) -> update file (cvs -q update file [file ... ]).
# Doesn't permit -r.
my($self) = shift;
my(@args) = @_;
my($cmd) = $self->_cmd('-q update');
$cmd .= @args ? join ' ' => @args
: '-d';
return $self->cvs_cmd($cmd);
}
sub up2date {
# Checks workspace status. No args.
my($self) = shift;
my($cmd) = $self->_cmd('-nq update -d');
return $self->cvs_cmd($cmd);
}
sub DESTROY {
my($self) = shift;
delete($cvs_bin_of {ident $self});
delete($external_of{ident $self});
delete($callback_of{ident $self});
return;
}
}
1;
__END__
=pod
=head1 NAME
Cvs::Simple - Perl interface to cvs
=head1 SYNOPSIS
use Cvs::Simple;
# Basic usage:
chdir('/path/to/sandbox')
or die "Failed to chdir to sandbox:$!";
my($cvs) = Cvs::Simple->new();
$cvs->add('file.txt');
$cvs->commit();
# Callback
my($commit_callback);
my($commit) = 0;
{
my($file) = 'file.txt';
($commit_callback) = sub {
my($cmd,$arg) = @_;
( run in 0.569 second using v1.01-cache-2.11-cpan-39bf76dae61 )