Package com.atlassian.bamboo.plugins.git
Interface GitOperationHelper
-
- All Known Implementing Classes:
AbstractGitOperationHelper,JGitOperationHelper,NativeGitOperationHelper
public interface GitOperationHelper
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull Stringcheckout(@Nullable File cacheDirectory, @NotNull File sourceDirectory, @NotNull String targetRevision, @Nullable String previousRevision)@NotNull Stringcheckout(@Nullable File cacheDirectory, @NotNull File sourceDirectory, @NotNull String targetRevision, @Nullable String previousRevision, boolean fetchLfsFiles)booleancheckRevisionExistsInCacheRepository(@NotNull File repositoryDirectory, @NotNull String targetRevision)default @NotNull Stringcommit(@NotNull File sourceDirectory, @NotNull String message, @NotNull String committerName, @NotNull String committerEmail)@NotNull Stringcommit(@NotNull File sourceDirectory, @NotNull String message, @NotNull String committerName, @NotNull String committerEmail, boolean stageModifications)voidcreateBranch(@NotNull File sourceDirectory, @NotNull String branchName)voidcreateLightweightTag(@NotNull File sourceDirectory, @NotNull String tagName, @NotNull String revision)BuildRepositoryChangesextractCommits(File cacheDirectory, @NotNull String startingRevision, String endingRevision)BuildRepositoryChangesextractCommits(File cacheDirectory, @NotNull String startingRevision, String endingRevision, String path)BuildRepositoryChangesextractCommitsBetweenBranches(File cacheDirectory, VcsBranch otherBranch, boolean limitChangeList)voidfetch(@NotNull File sourceDirectory, @NotNull HashAndSource refAndHash, boolean useShallow)voidfetch(@NotNull File sourceDirectory, @NotNull HashAndSource refAndHash, boolean useShallow, boolean fetchTagsByDefault)voidfetch(@NotNull File sourceDirectory, @NotNull HashAndSource refAndHash, boolean useShallow, boolean fetchTagsByDefault, boolean fetchLfsFiles)voidfetch(@NotNull File sourceDirectory, @NotNull String targetRevision, boolean useShallow)voidfetch(@NotNull File sourceDirectory, @NotNull String targetRevision, boolean useShallow, boolean fetchTagsByDefault)voidfetch(@NotNull File sourceDirectory, @NotNull String targetRevision, boolean useShallow, boolean fetchTagsByDefault, boolean fetchLfsFiles)@NotNull Optional<String>getBranchForSha(@NotNull File sourceDirectory, String revision, String configuredBranch)@NotNull CommitContextgetCommit(File directory, String targetRevision)Gets the commit for the revision, given a working directory.StringgetCurrentBranch(File checkoutPath)@NotNull StringgetCurrentRevision(@NotNull File sourceDirectory)@NotNull List<VcsBranch>getOpenBranches(@NotNull GitRepositoryAccessData repositoryData, File workingDir)@Nullable StringgetShaOfRefIfExists(@NotNull File sourceDirectory, @NotNull String ref)List<TagAndRevision>getTagsForRepository(@NotNull GitRepositoryAccessData accessData)booleanisAncestor(@NotNull Path gitWorkspace, @NotNull GitHash rev1, @NotNull GitHash rev2)Returns true if you can reach rev1 by following parent relationship starting from rev2.booleanisClean(@NotNull File sourceDirectory)booleanmerge(@NotNull File workspaceDir, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail)Pair<Boolean,String>mergeAndReturnHead(@NotNull File workspaceDir, @NotNull String currentRevision, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail)@NotNull HashAndSourceobtainLatestRevision()Optional<GitHash>obtainLatestRevision(@NotNull File repositoryDirectory, GitRef ref, String path)voidpushBranchOrTag(@NotNull File sourceDirectory, @NotNull String refName)voidpushRevision(@NotNull File sourceDirectory, @NotNull String revision, @Nullable String currentBranch)voidstageChanges(@NotNull File sourceDirectory, @NotNull Collection<String> pathsToAdd)
-
-
-
Method Detail
-
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
boolean isClean(@NotNull @NotNull File sourceDirectory) throws RepositoryException- Throws:
RepositoryException
-
getShaOfRefIfExists
@Nullable @Nullable String getShaOfRefIfExists(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String ref)
-
obtainLatestRevision
@NotNull @NotNull HashAndSource obtainLatestRevision() throws RepositoryException
- 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:
IOExceptionRepositoryException
-
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 RepositoryExceptionReturns 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
String getCurrentBranch(File checkoutPath) throws RepositoryException
- Throws:
RepositoryException
-
-