ePages 6.17.39 - DE_EPAGES/Core/API/Git.pm

Package DE_EPAGES::Core::API::Git

This module provides Git commands.

Example
my $Git = DE_EPAGES::Core::API::Git->new();
$Git->CloneRepository($RepoUrl);
@EXPORT_OK
CloneRepository
GetPatchCartridge
GitExportRepo
Add
Commit
Checkout
CreateBranch
ExistsRemoteBranch
ExistsLocalBranch
Merge
Push

Functions

Add
Checkout
CloneRepository
Commit
CreateBranch
ExistsLocalBranch
ExistsRemoteBranch
GetCommitId
GetPatchCartridge
GitExportRepo
Merge
Push
Remove
new

Add

Add a file or directory for the next commit.

Syntax
$self->Add($FileOrDirectory);
Input
$FileOrDirectory (string)
file or directory to add for commit
$aArguments (ref.array.string)
git add arguments

Checkout

Checkout a branch.

Syntax
$self->Checkout($Branch, $aArguments);
Input
$Branch (string)
name of the branch
$aArguments (ref.array.string)
git checkout arguments

CloneRepository

Clone a Git Repository.

Syntax
$self->CloneRepository($RepoUrl, $TargetDir, $aArguments);
Input
$RepoUrl (string)
url of a GitHub repository
$TargetDir (string)
target directory to clone files to
$aArguments (ref.array.string)
git clone arguments

Commit

Commit changes to current branch.

Syntax
$self->Commit($CommitString, $aArguments);
Input
$CommitString (string)
commit message
$aArguments (ref.array.string)
git commit arguments,
e.g. '-a' to directly add and commit a modified file

CreateBranch

Create a branch.

Syntax
$self->CreateBranch($Branch, $aArguments);
Input
$Branch (string)
name of the branch
$aArguments (ref.array.string)
git checkout arguments

ExistsLocalBranch

Check if a branch already exists local.

Syntax
$self->ExistsLocalBranch($Branch);
Input
$Branch (string)
name of the branch
Return
(bool)
1, if branch already exists local, 0 otherwise

ExistsRemoteBranch

Check if a branch already exists on remote.

Syntax
$self->ExistsRemoteBranch($Branch);
Input
$Branch (string)
name of the branch
Return
(bool)
1, if branch already exists on remote, 0 otherwise

GetCommitId

Get the commit ID (SHA-1) of given commit (i.e. HEAD). Based on the git command rev-parse.

Syntax
$self->GetCommitId($Commit, $aArguments);
Input
$Commit (string)
tag to identify a commit (i.e 'HEAD')
$aArguments (ref.array.string)
git rev-parse arguments (i.e. '--short')

GetPatchCartridge

Get an extracted archive of the Cartridge repository (or specified Cartridge) for specified tag/branch.

Syntax
$self->GetPatchCartridge($Tag, $TargetDir);
Input
$Version (string)
version to create tmp folder in Patches/PatchTemp/release_$Version
$BranchOrTag (string)
branch to get latest commit point or specified tag point from
$CartridgePath (string)
path to cartridge, e.g. /srv/epages/eproot/Cartridges/FlexProvider
$TargetDir (string)
target directory to extract files to

GitExportRepo

Get an extracted archive of the Cartridge repository (or specified Cartridge) for specified tag/branch.

Syntax
$self->GitExportRepo($BranchOrTag, $RepoTarget, $TargetDir, $TarFile, $CartridgePath);
Input
$BranchOrTag (string)
branch to get latest commit point or specified tag point from
$RepoSource (string)
folder where your .git folder is. Files will be exported from here.
$TargetDir (string)
target directory to extract files to
$TarFile (string)
name of the tar file
$CartridgePath (string)
path to cartridge, e.g. /srv/epages/eproot/Cartridges/FlexProvider

Merge

Merge changes from $FeatureBranch to $MergeBranch.

Syntax
$self->Merge($MergeBranch, $FeatureBranch, $aArguments);
Input
$MergeBranch (string)
name of the branch to merge into
$FeatureBranch (string)
name of the branch to merge from
$aArguments (ref.array.string)
git merge arguments

Push

Push current changes (file or directory) to remote.

Syntax
$self->Push($Remote, $aArguments);
Input
$Remote (string)
remote the changes will be pushed to
$Branch (string)
branch to be pushed
$aArguments (ref.array.string)
git push arguments

Remove

Remove a file or directory for the next commit.

Syntax
$self->Remove($FileOrDirectory);
Input
$FileOrDirectory (string)
file or directory to remove for commit
$aArguments (ref.array.string)
git rm arguments

new

Create a Git object.

Syntax
$Git = DE_EPAGES::Core::API::Git->new($hOptions);