Package com.atlassian.bamboo.plugins.git
Interface GitOperationHelper
- All Known Implementing Classes:
AbstractGitOperationHelper
,JGitOperationHelper
,NativeGitOperationHelper
public interface GitOperationHelper
-
Method Summary
Modifier and TypeMethodDescription@NotNull String
checkout
(@Nullable File cacheDirectory, @NotNull File sourceDirectory, @NotNull String targetRevision, @Nullable String previousRevision) @NotNull String
checkout
(@Nullable File cacheDirectory, @NotNull File sourceDirectory, @NotNull String targetRevision, @Nullable String previousRevision, boolean fetchLfsFiles) boolean
checkRevisionExistsInCacheRepository
(@NotNull File repositoryDirectory, @NotNull String targetRevision) default @NotNull String
commit
(@NotNull File sourceDirectory, @NotNull String message, @NotNull String committerName, @NotNull String committerEmail) @NotNull String
commit
(@NotNull File sourceDirectory, @NotNull String message, @NotNull String committerName, @NotNull String committerEmail, boolean stageModifications) void
createBranch
(@NotNull File sourceDirectory, @NotNull String branchName) void
createLightweightTag
(@NotNull File sourceDirectory, @NotNull String tagName, @NotNull String revision) extractCommits
(File cacheDirectory, @NotNull String startingRevision, String endingRevision) extractCommits
(File cacheDirectory, @NotNull String startingRevision, String endingRevision, String path) extractCommitsBetweenBranches
(File cacheDirectory, VcsBranch otherBranch, boolean limitChangeList) void
fetch
(@NotNull File sourceDirectory, @NotNull HashAndSource refAndHash, boolean useShallow) void
fetch
(@NotNull File sourceDirectory, @NotNull HashAndSource refAndHash, boolean useShallow, boolean fetchTagsByDefault) void
fetch
(@NotNull File sourceDirectory, @NotNull HashAndSource refAndHash, boolean useShallow, boolean fetchTagsByDefault, boolean fetchLfsFiles) void
void
fetch
(@NotNull File sourceDirectory, @NotNull String targetRevision, boolean useShallow, boolean fetchTagsByDefault) void
fetch
(@NotNull File sourceDirectory, @NotNull String targetRevision, boolean useShallow, boolean fetchTagsByDefault, boolean fetchLfsFiles) getBranchForSha
(@NotNull File sourceDirectory, String revision, String configuredBranch) @NotNull CommitContext
Gets the commit for the revision, given a working directory.getCurrentBranch
(File checkoutPath) @NotNull String
getCurrentRevision
(@NotNull File sourceDirectory) getOpenBranches
(@NotNull GitRepositoryAccessData repositoryData, File workingDir) @Nullable String
getShaOfRefIfExists
(@NotNull File sourceDirectory, @NotNull String ref) getTagsForRepository
(@NotNull GitRepositoryAccessData accessData) boolean
isAncestor
(@NotNull Path gitWorkspace, @NotNull GitHash rev1, @NotNull GitHash rev2) Returns true if you can reach rev1 by following parent relationship starting from rev2.boolean
boolean
merge
(@NotNull File workspaceDir, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail) mergeAndReturnHead
(@NotNull File workspaceDir, @NotNull String currentRevision, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail) @NotNull HashAndSource
obtainLatestRevision
(@NotNull File repositoryDirectory, GitRef ref, String path) void
pushBranchOrTag
(@NotNull File sourceDirectory, @NotNull String refName) void
pushRevision
(@NotNull File sourceDirectory, @NotNull String revision, @Nullable String currentBranch) void
stageChanges
(@NotNull File sourceDirectory, @NotNull Collection<String> pathsToAdd)
-
Method Details
-
pushRevision
void pushRevision(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String revision, @Nullable @Nullable String currentBranch) throws RepositoryException - Throws:
RepositoryException
-
pushBranchOrTag
void pushBranchOrTag(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String refName) throws RepositoryException - Throws:
RepositoryException
-
commit
@NotNull default @NotNull String commit(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String message, @NotNull @NotNull String committerName, @NotNull @NotNull String committerEmail) throws RepositoryException - Throws:
RepositoryException
-
commit
@NotNull @NotNull String commit(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String message, @NotNull @NotNull String committerName, @NotNull @NotNull String committerEmail, boolean stageModifications) throws RepositoryException - Throws:
RepositoryException
-
stageChanges
void stageChanges(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull Collection<String> pathsToAdd) throws RepositoryException - Throws:
RepositoryException
-
checkout
@NotNull @NotNull String checkout(@Nullable @Nullable File cacheDirectory, @NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetRevision, @Nullable @Nullable String previousRevision, boolean fetchLfsFiles) throws RepositoryException - Throws:
RepositoryException
-
checkout
@NotNull @NotNull String checkout(@Nullable @Nullable File cacheDirectory, @NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetRevision, @Nullable @Nullable String previousRevision) throws RepositoryException - Throws:
RepositoryException
-
fetch
void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetRevision, boolean useShallow) throws RepositoryException - Throws:
RepositoryException
-
fetch
void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetRevision, boolean useShallow, boolean fetchTagsByDefault) throws RepositoryException - Throws:
RepositoryException
-
fetch
void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetRevision, boolean useShallow, boolean fetchTagsByDefault, boolean fetchLfsFiles) throws RepositoryException - Throws:
RepositoryException
-
fetch
void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull HashAndSource refAndHash, boolean useShallow) throws RepositoryException - Throws:
RepositoryException
-
fetch
void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull HashAndSource refAndHash, boolean useShallow, boolean fetchTagsByDefault) throws RepositoryException - Throws:
RepositoryException
-
fetch
void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull HashAndSource refAndHash, boolean useShallow, boolean fetchTagsByDefault, boolean fetchLfsFiles) throws RepositoryException - Throws:
RepositoryException
-
getCurrentRevision
@NotNull @NotNull String getCurrentRevision(@NotNull @NotNull File sourceDirectory) throws RepositoryException - Throws:
RepositoryException
-
getTagsForRepository
List<TagAndRevision> getTagsForRepository(@NotNull @NotNull GitRepositoryAccessData accessData) throws RepositoryException - Throws:
RepositoryException
-
isClean
- Throws:
RepositoryException
-
getShaOfRefIfExists
-
obtainLatestRevision
- Throws:
RepositoryException
-
getOpenBranches
@NotNull @NotNull List<VcsBranch> getOpenBranches(@NotNull @NotNull GitRepositoryAccessData repositoryData, File workingDir) throws RepositoryException - Throws:
RepositoryException
-
checkRevisionExistsInCacheRepository
boolean checkRevisionExistsInCacheRepository(@NotNull @NotNull File repositoryDirectory, @NotNull @NotNull String targetRevision) throws IOException, RepositoryException - Throws:
IOException
RepositoryException
-
getCommit
@NotNull @NotNull CommitContext getCommit(File directory, String targetRevision) throws RepositoryException Gets the commit for the revision, given a working directory.- Throws:
RepositoryException
- if the revision can't be found
-
merge
boolean merge(@NotNull @NotNull File workspaceDir, @NotNull @NotNull String targetRevision, @NotNull @NotNull String committerName, @NotNull @NotNull String committerEmail) throws RepositoryException - Throws:
RepositoryException
-
mergeAndReturnHead
Pair<Boolean,String> mergeAndReturnHead(@NotNull @NotNull File workspaceDir, @NotNull @NotNull String currentRevision, @NotNull @NotNull String targetRevision, @NotNull @NotNull String committerName, @NotNull @NotNull String committerEmail) throws RepositoryException - Throws:
RepositoryException
-
extractCommits
BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull @NotNull String startingRevision, String endingRevision) throws RepositoryException - Throws:
RepositoryException
-
getBranchForSha
@NotNull @NotNull Optional<String> getBranchForSha(@NotNull @NotNull File sourceDirectory, String revision, String configuredBranch) throws RepositoryException - Returns:
- branch that contains sha and matches the name of configuredBranch
- Throws:
RepositoryException
-
obtainLatestRevision
Optional<GitHash> obtainLatestRevision(@NotNull @NotNull File repositoryDirectory, GitRef ref, String path) throws RepositoryException - Throws:
RepositoryException
-
isAncestor
boolean isAncestor(@NotNull @NotNull Path gitWorkspace, @NotNull @NotNull GitHash rev1, @NotNull @NotNull GitHash rev2) throws RepositoryException Returns true if you can reach rev1 by following parent relationship starting from rev2.- Throws:
RepositoryException
-
extractCommits
BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull @NotNull String startingRevision, String endingRevision, String path) throws RepositoryException - Throws:
RepositoryException
-
extractCommitsBetweenBranches
BuildRepositoryChanges extractCommitsBetweenBranches(File cacheDirectory, VcsBranch otherBranch, boolean limitChangeList) throws RepositoryException - Throws:
RepositoryException
-
createBranch
void createBranch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String branchName) throws RepositoryException - Throws:
RepositoryException
-
createLightweightTag
void createLightweightTag(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String tagName, @NotNull @NotNull String revision) throws RepositoryException - Throws:
RepositoryException
-
getCurrentBranch
- Throws:
RepositoryException
-