Cvs::Simple - Perl interface to cvs
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) = @_; if($arg=~/Checking in $file;/) { ++$commit } }; } my($cvs) = Cvs::Simple->new(); $cvs->callback(commit => $commit_callback); $cvs->add('file.txt'); $cvs->commit(); croak "Failed to commit file.txt" unless($commit); $cvs->unset_callback('commit');
Cvs::Simple is an attempt to provide an easy-to-use wrapper that allows cvs commands to be executed from within a Perl program, without the programmer having to wade through the (many) cvs global and command-specific options.
Cvs::Simple
The methods provided follow closely the recipes list in "Pragmatic Version Control with CVS" by Dave Thomas and Andy Hunt (see http://www.pragmaticprogrammer.com/starter_kit/vcc/index.html).
Creates an instance of Cvs::Simple.
CONFIG_ITEMS is a hash of configuration items. Recognised configuration items are:
See the method descriptions below for details of these. If none are specified, CVS::Simple will choose some sensible defaults.
Specify a function pointed to by CODEREF to be executed for every line output by CMD.
Permitted values of CMD are All (executed on every line of output), add, commit, checkout, diff, update. CMD is also permitted to be undef, in which case, it will be assumed to be All.
All
add
commit
checkout
diff
update
cvs_cmd passes two arguments to callbacks: the actual command called, and the line returned by CVS.
See the tests for examples of callbacks.
Remove the callback set for CMD.
Specifies the location and name of the CVS binary. Default to /usr/bin/cvs.
/usr/bin/cvs
cvs_cmd() does the actual work of calling the equivalent CVS command. If any callbacks have been set, they will be executed for every line received from the command. If no callbacks have been set, all output is to STDOUT.
Specify an "external" repository. This can be a genuinely remote repository in :ext:user@repos.tld:/path/to/cvsroot format, or an alternative repository on the local host. This will be passed to the -d CVS global option.
:ext:user@repos.tld:/path/to/cvsroot
-d
Add a file or files to the repository; equivalent to cvs add file1, ...., or cvs add -kb file1, ... in the case of add_bin().
cvs add file1, ....
cvs add -kb file1, ...
Alias for checkout()
Note that co() can be used as an alias for checkout().
Alias for commit().
These are the equivalent of cvs commit -m "", cvs commit -m "" file1, file2, ...., fileN, cvs commit -r TAG -m "" and cvs commit -r TAG -m "" file1, file2, ...., fileN respectively.
cvs commit -m ""
cvs commit -m "" file1, file2, ...., fileN
cvs commit -r TAG -m ""
cvs commit -r TAG -m "" file1, file2, ...., fileN
Note that ci() can be used as an alias for commit().
FILE_OR_DIR is a single file, or a directory, in the sandbox.
Performs context diff: equivalent to cvs diff -c FILE_OR_DIR or cvs diff -c -rTAG1 -rTAG2 FILE_OR_DIR.
cvs diff -c FILE_OR_DIR
cvs diff -c -rTAG1 -rTAG2 FILE_OR_DIR
This is the equivalent of cvs -q update -jOLD_REV -jNEW_REV FILENAME. Note for callback purposes that this is actually an update().
cvs -q update -jOLD_REV -jNEW_REV FILENAME
Reverts from CURRENT_REV to REVERT_REV. Equivalent to cvs update -jCURRENT_REV -jREVERT_REV FILENAME.
cvs update -jCURRENT_REV -jREVERT_REV FILENAME
Note that backout() can be used as an alias for undo().
Note that for callback purposes this is actually an update().
Alias for update().
Equivalent to cvs -q update -d and cvs -d update file1, ..., filex.
cvs -q update -d
cvs -d update file1, ..., filex
Note that updates to a specific revision (-r) and sticky-tag resets (-A) are not currently supported.
-r
-A
Note that upd() is an alias for update().
Short-hand for cvs -nq update -d.
cvs -nq update -d
Equivalent to cvs status -v.
cvs status -v
None by default.
cvs_cmd
IPC::Run
merge
undo
cvs(1), Cvs, VCS::Cvs
Stephen Cardie, <stephenca@ls26.net>
Copyright (C) 2007,2008 by Stephen Cardie
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
Expected text after =item, not a bullet
To install Cvs_Test, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cvs_Test
CPAN shell
perl -MCPAN -e shell install Cvs_Test
For more information on module installation, please visit the detailed CPAN module installation guide.