ePages 6.10 - DE_EPAGES/Core/API/CVS.pm

Package DE_EPAGES::Core::API::CVS

This module provides cvs commands and complex cvs actions.

Example
my $CVS = DE_EPAGES::Core::API::CVS->new({ -q => '' });
$CVS->command( 'export',  { '-d' => 'source', '-r' => 'relase_5_0_1' }, ['RND/epages/epages5'] );
@EXPORT_OK
Checkout
CVSAdd
CVSCommand
Export
GetExistingDirectories
GetRevisionsByOutput
GetRevisionsByBranch
GetRevisionsByBranchNumberByOutput
RemoveBranch
RemoveTag
SymbolicNames
SymbolicNamesByOutput

Functions

CVSAdd
CVSCommand
Checkout
Export
GetExistingDirectories
GetRevisionsByBranch
GetRevisionsByBranchNumberByOutput
GetRevisionsByOutput
RemoveBranch
RemoveTag
SymbolicNames
SymbolicNamesByOutput
add
command
getDiffFiles
new

CVSAdd

Adds a file or directory to CVS. Directories can be added recursively.

Syntax
CVSAdd($FileOrDirectory, $hOptions);
CVSAdd('DE_EPAGES/Core', { recursive => 1 });
Input
$FileOrDirectory (string)
file name
$hOptions (ref.hash.string)
(optional) hash with options:
  • recursive - true if sub directories and files should be added

CVSCommand

Executes an cvs command

Syntax
$hOut = CVSCommand($Command, $aArguments, $hCVSOptions, $hCVSCommandOptions, $hOptions);
Example
$hOut = CVSCommand('add', ['test.pl'], { '-q' => '' }, { '-k' => 'b' });
Input
$Command (string)
command name of (like add, commit, rtag, rdiff, ...)
$aArguments (ref.array.string)
files names, multiple options (like -r or -j)
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)
$hCVSCommandOptions (ref.hash.string)
cvs command options (like -m of commit command)
$hOptions (ref.hash.string)
keys
  • outlines - collect lines of output - boolean
  • errlines - collect lines of error output - boolean
  • outcontent - complete output - boolean
  • errcontent - complete error output - boolean
  • skiperrors - ignore return code of cvs command - boolean
  • displayonly - display command but do not execute - boolean
Return
$hOut (string)
directory/file path

Checkout

get the content of a repository by the given branch or tag name, including cvs helper directories.

Syntax
Checkout($FileOrDirectory, $Tag, $hCVSOptions);
Example
Checkout('RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Core', 'B_patch_5_0_3');
Input
$FileOrDirectory (string)
repository name
$Tag (string)
branch or tag name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)

Export

get the content of a repository by the given branch or tag name, without cvs helper directories.

Syntax
Export($FileOrDirectory, $Tag, $hCVSOptions);
Example
Export('RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Core', 'B_patch_5_0_3');
Input
$FileOrDirectory (string)
repository name
$Tag (string)
branch or tag name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)

GetExistingDirectories

get directories in repository, uses Export to get info.

Syntax
GetExistingDirectories($FileOrDirectory, $Tag, $hCVSOptions);
Input
$FileOrDirectory (string)
repository name
$Tag (string)
branch or tag name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)

GetRevisionsByBranch

Returns the numeric revisions of a repository file by the given branch name.

Syntax
$aRevisions = GetRevisionsByBranch($FileName, $Branch, $hCVSOptions);
Example
my $aRevisions = GetRevisionsByBranch('DE_EPAGES/Core/API/CVS.pm', 'B_patch_5_0_3');
Input
$FileName (string)
file name
$Branch (string)
branch name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)
Return
$aRevisions (ref.array.string)
revision numbers

GetRevisionsByBranchNumberByOutput

Returns the numeric revisions, see GetRevisionsByBranchName.

Syntax
$aRevisions = GetRevisionsByBranchNumberByOutput($BranchNumber, $aLogOut);
Example
my $out_log = CVSCommand ('log', [$RemoteFileName], \%CVSOptions, undef, {'outlines' => 1});
my $hSymbolicNames = SymbolicNamesByOutput($out_log->{'outlines'});
return GetRevisionsByBranchNumberByOutput($hSymbolicNames->{$BrachName}, $out_log->{'outlines'});
Input
$BranchNumber (string)
branch number
$aLogOut (ref.array.string)
output lines of log file
Return
$aRevisions (ref.array.string)
revision numbers

GetRevisionsByOutput

Returns all revisions of a file.

Syntax
$ahRevisions = GetRevisionsByOutput($aLogOut);
Example
my $out_log = CVSCommand ('log', [$RemoteFileName], \%CVSOptions, undef, {'outlines' => 1});
my $ahRevisions = GetRevisionsByOutput($out_log->{'outlines'});
Input
$aLogOut (ref.array.string)
output lines of log file
Return
$ahRevisions (ref.array.hash)
revisions, keys: revision, branches, author, description, date, ...

RemoveBranch

removes a tags and revisions a branch.

Syntax
RemoveBranch($FileOrDirectory, $Tag, $hCVSOptions);
Input
$FileOrDirectory (string)
repository name
$Branch (string)
branch name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)

RemoveTag

removes a tag of a repository by the given tag name.

Syntax
RemoveTag($FileOrDirectory, $Tag, $hCVSOptions, $hCommandOptions);
Input
$FileOrDirectory (string)
repository name
$Tag (string)
branch or tag name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)
$hCommandOptions (ref.hash.string)
options (like -B if it is a branch tag)

SymbolicNames

Returns the symbolic names and revision numbers of an file at repository.

Syntax
$hNames = SymbolicNames($RemoteFileName, $hCVSOptions);
Input
$RemoteFileName (string)
file name
$hCVSOptions (ref.hash.string)
cvs options (like -q, -d CVSROOT)
Return
$hNames (ref.hash)
name => revision map

SymbolicNamesByOutput

Returns the symbolic names and revision numbers, see SymbolicNames

Syntax
$hNames = SymbolicNamesByOutput($aLogOut);
Example
my $out_log = CVSCommand('rlog', [$File], $hCVSOptions, undef, {'outlines' => 1});
my $hNames = SymbolicNamesByOutput($out_log->{'outlines'});
Input
$aLogOut (ref.array.string)
output lines of log file
Return
$hNames (ref.hash)
name => revision map

add

Adds a file or directory to CVS. Directories can be added recursively.

Syntax
$CVS->add($FileOrDirectory, $hOptions);
$CVS->add('DE_EPAGES/Core', { recursive => 1 });
Input
$FileOrDirectory (string)
file name
$hOptions (ref.hash.string)
(optional) hash with options:
  • recursive - true if sub directories and files should be added

command

Executes a CVS command

Syntax
$hOut = $CVS->command($Command, $aCommandOptions, $aArguments);
$hOut = $CVS->command($Command, $hCommandOptions, $aArguments, $hCVSOptions, $hOptions);
$hOut = $CVS->command($Command, $aCommandOptions, $aArguments, $hCVSOptions, $hOptions);
Example
$hOut = $CVS->command('add', { '-k' => 'b' }, ['test.pl'], { '-q' => '' }, {'print' => 1});
$hOut = $CVS->command('tag', ['-F'], ['release_x_y', 'test.pl'], { '-q' => '' });
Input
$Command (string)
command name of (like add, commit, rtag, rdiff, ...)
$aCommandOptions (ref.array.string)
cvs command options as array, e.g. [ '-m', 'comment' ]
$hCommandOptions (ref.hash.string)
cvs command options as hash, e.g. { '-m' => 'comment' }
$aArguments (ref.array.string)
file or module names
$hCVSOptions (ref.hash.string)
(optional) cvs options (like -q, -d CVSROOT)
$hOptions (ref.hash.string)
see new
Return
$hOut (string)
directory/file path

getDiffFiles

Returns the files that differ betweewn 2 revisions.

Syntax
$aFileNames = $CVS->getDiffFiles($Module, $OldRevision, $NewRevision);
$aFileNames = $CVS->getDiffFiles($Module, $OldRevision, $NewRevision, $hOptions);
Example
$aFileNames = $CVS->getDiffFiles('RND/epages/epages5', 'release_5_0_1', 'release_5_0_2');
Input
$Module (string)
CVS path
$OldRevision (string)
old revision or tag
$NewRevision (string)
new revision or tag
$hOptions (ref.hash.string)
(optional) keys
  • verbose - print differences - boolean
  • print - print command line - boolean
Return
$hOut (string)
directory/file path

new

Createa a CVS object.

Syntax
$CVS = DE_EPAGES::Core::API::CVS->new($hCVSOptions, $hOptions);
Example
$CVS = DE_EPAGES::Core::API::CVS->new({ -q => '' }, { 'print' => 1 });
Input
$hCVSOptions (ref.hash.string)
(optional) cvs options (like -q, -d CVSROOT)
$hOptions (ref.hash.string)
(optional) common options; keys
  • outlines - collect lines of output - boolean
  • errlines - collect lines of error output - boolean
  • outcontent - complete output - boolean
  • errcontent - complete error output - boolean
  • skiperrors - ignore return code of cvs command - boolean
  • noexec - do not execute - boolean
  • print - print command line - boolean
  • printOutput - print command output - boolean