ePages 7.3.0 - DE_EPAGES/Installer/API/CVSTagHandler.pm

Package DE_EPAGES::Installer::API::CVSTagHandler

Collection of utility functions for tag process. Will be moved to git.

Base
DE_EPAGES::Core::API::CVS

Functions

checkout
contentChanged
continuousUpdateTags
deleteRevisions
existsTagOnFile
export
getAllReleaseTags
getChangedFiles
getChangedFilesWithChangedContent
getChangedFilesWithUnchangedContent
getCommentForRevision
getInfoForTag
getLatestCorrespondingHotFixTag
getLatestReleaseTag
getMergeRevisions
getOnlyHotFixMergeRevisions
getPreviousRevision
getRevision
getRevisionDiff
getRevisionDifffAsHash
getRevisionRdiff
inspectionAffectedFile
isDirectSuccessor
new
patchAffectedFile
removeTag
removeTagByServer
sendInspectionFileMail
sendMergeMail
sendPatchFileMail
setTag
setTagByServer
updateChanges
updateFile
updatePatchTag
updateReleaseTag

checkout

executes cvs checkout on cvsfile, using branch or revision to target directory

Syntax
$CVSTagHandler->checkout( $CVSFile, $BranchOrRevision, $TargetDirectory );
Input
$CVSFile (string)
cvs file to be checked out, should look like "RND/epages..."
$BranchOrRevision (string)
either a branch or a revision to take cvs file from
$TargetDirectory (optional)
target directory | string
Return
$hResult (ref hash)
result hash containing console output

contentChanged

returns true if the content changed between revisions tagged with specific tags

Syntax
$ContentChanged = $CVSTagHandler->contentChanged( $File, $StartTag, $EndTag );
Input
$File (String)
cvs path of file
$StartTag (String)
first tag
$EndTag (String)
second tag
Return
$ContentChanged (bool)
true if content of file changed between tags

continuousUpdateTags

update the patch tag for files where content changed between release tags, the release tag have to be already updated Optional Parameter:

Syntax
$Handler->continuousUpdateTags( $ReleaseOld, $ReleaseNew, $PatchNew, $hOptions );
$aAffectedFiles = $Handler->continuousUpdateTags( $ReleaseOld, $ReleaseNew, $PatchNew,  {
    return_patch_affected_files => 1,
});
Example
$Handler->continuousUpdateTags(
    'release_6_12_0',
    'release_6_12_1',
    'patch_6_12_1',
    'B_deployment_6_12_1',
    {
        'verbose' => 1
    }
 );
Input
$ReleaseOld (String)
old release tag
$ReleaseNew (String)
new release tag
$PatchNew (String)
new patch tag to be set
$BranchOrTag (String)
tag of Branch
%hOptions (ref.hash.string)
keys
  • verbose - flag to print messages - string/bool
Return
$aAffectedFiles (ref.array)
list of affected files
(if $hOptions->{return_patch_affected_files} is true, otherwise the
return value is undefined)

deleteRevisions

delete all revisions from start revision to end revision, inclusive, on the same branch handle with care

Syntax
$CVSTagHandler->deleteRevisions( $StartRevision, $EndRevision, $TargetFileName );
Input
$StartRevision (string)
first revision to be deleted
$EndRevision (string)
last revision to be deleted
$TargetFileName (string)
target file
Return
$hResult (ref hash)
result hash containing console output

existsTagOnFile

return true if tag exists on file

Syntax
$TagExists = $CVSTagHandler->existsTagOnFile($File,$Tag);
Input
$File (String)
cvs path of file
$Tag (String)
tag name
Return
$TagExists (bool)
true if tag exists on file

export

executes cvs export on cvsfile, using branch or revision to target directory

Syntax
$CVSTagHandler->export( $CVSFile, $BranchOrRevision, $TargetDirectory );
Input
$CVSFile (string)
cvs file to be checked out, should look like "RND/epages..."
$BranchOrRevision (string)
either a branch or a revision to take cvs file from
$TargetDirectory (string)
target directory
Return
$hResult (ref hash)
result hash containing console output

getAllReleaseTags

returns all release tags from file

Syntax
$aReleaseTags = $CVSTagHandler->getAllReleaseTags( $File );
Input
$File (String)
cvs path of file
Return
$aReleaseTags (string)
all release tags from file

getChangedFiles

return the list of files that are taggt and have changed revision Optional Parameter:

Syntax
$Handler->getChangedFiles( $StartTag, $EndTag, %hOptions );
Example
my $aList = $Handler->getChangedFiles(
    'release_6_11_3',
    'patch_6_12_0',
    {'cvsdirectory' => 'RND/epages/epages5/AllOS/Cartridges/Presentation'}
);
Input
$StartTag (String)
first tag
$EndTag (String)
second tag
%hOptions (ref.hash.string)
keys
  • cvspath - repository URL (directory only) - string
  • verbose - flag to print messages - string/bool
Return
$aChangedFiles (ref.array.String)
list of path's from files that changed

getChangedFilesWithChangedContent

return the list of files that are taggt and have changed revisions and changed content Optional Parameter:

Syntax
$Handler->getChangedFilesWithChangedContent( $StartTag, $EndTag, %hOptions );
Example
my $aList = $Handler->getFileListUnchangedContent(
    'release_6_11_3',
    'patch_6_12_0',
    {'cvsdirectory' => 'RND/epages/epages5/AllOS/Cartridges/Presentation'}
 );
Input
$StartTag (String)
first tag
$EndTag (String)
second tag
%hOptions (ref.hash.string)
keys
  • cvspath - repository URL (directory only) - string
  • verbose - flag to print messages - string/bool
Return
$aChangedFiles (ref.array.String)
list of path's from files that changed

getChangedFilesWithUnchangedContent

return the list of files that are taggt and have changed revisions but identical content Optional Parameter:

Syntax
$Handler->getChangedFilesWithUnchangedContent( $StartTag, $EndTag, %hOptions );
Example
my $aList = $Handler->getFileListUnchangedContent(
    'release_6_11_3',
    'patch_6_12_0',
    {'cvsdirectory' => 'RND/epages/epages5/AllOS/Cartridges/Presentation'}
 );
Input
$StartTag (String)
first tag
$EndTag (String)
second tag
%hOptions (ref.hash.string)
keys
  • cvspath - repository URL (directory only) - string
  • verbose - flag to print messages - string/bool
Return
$aChangedFiles (ref.array.String)
list of path's from files that changed

getCommentForRevision

returns the comment of the revision from file

Syntax
$Comment = $CVSTagHandler->getCommentForRevision( $File, $Revision );
Input
$File (String)
cvs path of file
$Revision (String)
revision of file
Return
$Comment (string)
comment for revision

getInfoForTag

returns the name of the engineer that checked in the file tagged with specific tag

Syntax
$EngineerName = $CVSTagHandler->getInfoForTag( $File, $Tag );
Input
$File (String)
cvs path of file
$Tag (String)
tag of file
Return
$hInfo (string)
name of the engineer who checkt in the file

getLatestCorrespondingHotFixTag

returns the highest hot fix tag of the file tagged with specific tag

Syntax
$HotFixTag = $CVSTagHandler->getLatestCorrespondingHotFixTag( $File, $Tag );
Input
$File (String)
cvs path of file
$Tag (String)
tag of file
Return
$HotFixTag (string)
highest hot fix tag of the file tagged with specific tag

getLatestReleaseTag

returns the highest release Tag from file

Syntax
$ReleaseTag = $CVSTagHandler->getLatestReleaseTag( $File );
Input
$File (String)
cvs path of file
Return
$ReleaseTag (string)
highest release tag from file

getMergeRevisions

returns the revisions to be merged

Syntax
$CVSTagHandler->getMergeRevisions( $aRevisions );
Input
$aRevisions (ref array)
array of revisions
Return
$hResult (ref hash)
hash of revisions, key as start revision and value as end revision

getOnlyHotFixMergeRevisions

returns the revisions to be merged

Syntax
$CVSTagHandler->getOnlyHotFixMergeRevisions( $File, $aRevisions );
Input
$File (String)
cvs path of file
$aRevisions (ref array)
array of revisions
Return
$hResult (ref hash)
hash of revisions, key as start revision and value as end revision

getPreviousRevision

returns the predecessor of passed revision

Syntax
$CVSTagHandler->getPreviousRevision( $Rev );
Input
$Rev (String)
revision number
Return
$PrevRevision (string)
previsious revision

getRevision

returns the revision of the file tagged with specific tag

Syntax
$Revision = $CVSTagHandler->getRevision( $File, $Tag );
Input
$File (String)
cvs path of file
$Tag (String)
tag of file
Return
$Revision (string)
revision of the file tagged with specific tag

getRevisionDiff

executes cvs diff command

Syntax
$CVSTagHandler->getRevisionDiff( $StartRevision, $EndRevision, $TargetFileName );
Input
$StartRevision (string)
first revision for diff
$EndRevision (string)
last revision for diff
$TargetFileName (string)
l
Return
$hResult (ref hash)
result hash containing console output

getRevisionDifffAsHash

executes cvs diff command and transforms result in hash

Syntax
$CVSTagHandler->getRevisionDifffAsHash( $StartRevision, $EndRevision, $TargetFileName );
Input
$StartRevision (string)
first revision for diff
$EndRevision (string)
last revision for diff
$TargetFileName (string)
l
Return
$hResult (ref hash)
keys
  • changed
  • old
  • new
  • added
  • deleted

getRevisionRdiff

executes cvs rdiff command

Syntax
$CVSTagHandler->getRevisionRdiff( $StartRevision, $EndRevision, $CVSFile );
Input
$StartRevision (string)
first revision for rdiff
$EndRevision (string)
last revision for rdiff
$CVSFile (string)
cvs file for rdiff, should look like "RND/epages..."
Return
$hResult (ref hash)
result hash containing console output

inspectionAffectedFile

return true if the file is inspection relevant

Syntax
$FileIsAffectedByInspection=$Handler->inspectionAffectedFile( $FilePath );
Example
if ($Handler->inspectionAffectedFile('RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Object/API/Cartridge.pm')){
    ...
};
Input
$FilePath (String)
path from a specific file
Return
$FileIsAffected (boolean)
returns true if file have an affect on the patch

isDirectSuccessor

returns true if the second revision is direct successor of first revision

Syntax
$CVSTagHandler->isDirectSuccessor( $Rev1, $Rev2 );
Input
$Rev1 (String)
first revision number
$Rev2 (String)
second revision number
Return
$IsSuccessor (boolean)
true if revision 2 is successor of revision 1

new

Creates a new tag handler object

Syntax
$TagHandler = DE_EPAGES::Installer::API::CVSTagHandler->new(
    'verbose' => 1
);
Input
$hOptions (hash)
keys
  • verbose - print messages if set to 1

Return
$TagHandler (object)
tag handler object

patchAffectedFile

return true if the file is patch relevant

Syntax
$FileIsAffectedByPatch=$Handler->patchAffectedFile( $FilePath );
Example
if ($Handler->patchAffectedFile('RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Object/API/Cartridge.pm')){
    ...
};
Input
$FilePath (String)
path from a specific file
Return
$FileIsAffected (boolean)
returns true if file have an affect on the patch

removeTag

remove a tag from file

Syntax
$Handler->removeTag( $File, $Tag );
Example
my $Message = $Handler->removeTag(
    'RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Object/API/SQLCompare.pm',
    'patch_6_12_1',
);
Input
$File (String)
cvs path of file
$Tag (String)
tag to remove
Return
$Message (String)
message for remove tag

removeTagByServer

remove a tag from file, using server command (rtag)

Syntax
$Handler->removeTagByServer($Tag, $Path);
Example
my $Message = $Handler->removeTagByServer(
    'patch_6_12_1',
    'RND/epages/epages5'
);
Input
$Tag (String)
tag to remove
$CVSPath (String)
cvs path
Return
$Message (String)
message for remove tag

sendInspectionFileMail

send an info Mail to the inspection engineer

Syntax
$Handler->sendInspectionFileMail( $Tag, $MailAddress, $aChangedFiles, $aDeletedFiles, $aPatchFiles, $aManuelSetReleaseFiles );
Example
$Handler->sendPatchFileMail(
    'patch_6_13_0',
    'patch@epages.com'
    \@ChangedFiles,
    \@DeletedFiles,
    \@PatchFiles,
    \@ManualSetReleaseFiles
    \@ManualSetPatchFiles
 );
Input
$Tag (String)
tag
$MailAddress (String)
mail address
$aChangedFiles (ref.array)
list of changed files
$aDeletedFiles (ref.array)
list of deleted files
$aPatchFiles (ref.array)
list of patch files
$aManuelSetReleaseFiles (ref.array)
list of files getting the release tag manually
$aManuelSetPatchFiles (ref.array)
list of files getting the tag tag manually

sendMergeMail

sends merge mail to adresses in mail adress array

Syntax
$CVSTagHandler->sendMergeMail( $aMailAddress, $Message, $EPG, $ahFiles );
Input
$aMailAddress (ref array)
array of mail adresses
$Message (ref array)
array containing singe lines
$EPG (string)
EPG number, can be "EPG-123", "EPG 123" or "123"
$ahFiles (reference to array of hashes)
with following keys:
  • filename - path to file or filename - string
  • type - content type (optional)
    default:Application/Octet-stream - string
  • data - document to attach (optional) - binary
  • encoding - document's encoding (optional) - string
    default:base64

sendPatchFileMail

send an Info Mail to the patch building engineer

Syntax
$Handler->sendPatchFileMail( $Tag, $MailAddress, $aChangedFiles, $aDeletedFiles );
Example
$Handler->sendPatchFileMail(
    'patch_6_13_0',
    'patch@epages.com'
    \@ChangedFiles,
    \@DeletedFiles
 );
Input
$Tag (String)
tag
$MailAddress (String)
mail address
$aChangedFiles (ref.array)
list of changed files
$aDeletedFiles (ref.array)
list of deleted files

setTag

set a tag on file

Syntax
$Handler->setTag( $File, $TargetTagOrRevision, $Tag );
Example
my $Message = $Handler->setTag(
    'RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Object/API/SQLCompare.pm',
    'release_6_12_2',
    'patch_6_12_2'
);
my $Message = $Handler->setTag(
    'RND/epages/epages5/AllOS/Cartridges/DE_EPAGES/Object/API/SQLCompare.pm',
    '1.2.43.2',
    'patch_6_12_2'
);
Input
$File (String)
cvs path of file
$TargetTagOrRevision (String)
name of tag or revision number
$Tag (String)
tag to set
Return
$Message (String)
message for remove tag

setTagByServer

set a tag on file, using server command (rtag)

Syntax
$Handler->setTagByServer($Tag, $TagOrBranch, $Path);
Example
my $Message = $Handler->setTagByServer(
    'patch_6_12_1',
    'HEAD',
    'RND/epages/epages5'
);
Input
$Tag (String)
tag to set
$TagOrBranch (String)
target tag to set the tag on
$CVSPath (String)
cvs path
Return
$Message (String)
message for set tag

updateChanges

update changes from start revision to end revision

Syntax
$CVSTagHandler->updateChanges( $StartRevision, $EndRevision, $TargetFileName );
Input
$StartRevision (string)
start revision to update from
$EndRevision (string)
end revision to update to
$TargetDirectory (string)
target directory
Return
$hResult (ref hash)
result hash containing console output

updateFile

Synchronizes file on hard disk with CVS repository.

Syntax
$CVSTagHandler->updateFile($FileName, $Tag);
Input
$FileName (string)
file to update
$Tag (string)
tag to update from a specific revision (optional)
Return
$hResult (ref hash)
result hash containing console output

updatePatchTag

update the patch tag for files where content changed between release tags, the release tag have to be already updated Optional Parameter:

Syntax
updatePatchTag( $ReleaseOld, $ReleaseNew, $PatchNew, $hOptions );
Example
$Handler->updatePatchTag(
    'release_6_12_0',
    'release_6_12_1',
    'patch_6_12_1',
    {
        'cvsdirectory' => 'RND/epages/epages5/AllOS/Cartridges/Presentation',
        'verbose' => 1
    }
 );
Input
$ReleaseOld (String)
old release tag
$ReleaseNew (String)
new release tag
$ReleaseNew (String)
new patch tag to be set
%hOptions (ref.hash.string)
keys
  • cvspath - repository URL (directory only) - string
  • verbose - flag to print messages - string/bool

updateReleaseTag

update the release tag Optional Parameter:

Syntax
$Handler->updateReleaseTag( $ReleaseNew, $BranchOrTag, $hOptions );
Example
$Handler->updateReleaseTag(
    'release_6_12_1',
    'B_deployment_6_12_1',
    {
        'verbose' => 1
    }
);
$Handler->updateReleaseTag(
    'test_release_6_17_4',
    'new_deploy_test',
    {
        'verbose' => 1
    }
 );
Input
$ReleaseNew (String)
new release tag
$BranchOrTag (String)
tag or branch
%hOptions (ref.hash.string)
keys
  • verbose - flag to print messages - string/bool