public class NativeGitOperationHelper extends AbstractGitOperationHelper implements GitOperationHelper
| Modifier and Type | Field and Description |
|---|---|
static GitRef |
ALL_REFS |
protected SshProxyService |
sshProxyService |
accessData, buildLogger, CHANGESET_LIMIT, DEFAULT_TRANSFER_TIMEOUT, FQREF_PREFIXES, i18nResolver, trustedKeyHelper| Constructor and Description |
|---|
NativeGitOperationHelper(AbstractGitExecutor repository,
GitRepositoryAccessData accessData,
SshProxyService sshProxyService,
BuildLogger buildLogger,
com.atlassian.sal.api.message.I18nResolver i18nResolver,
TrustedKeyHelper trustedKeyHelper) |
NativeGitOperationHelper(GitRepository repository,
GitRepositoryAccessData accessData,
SshProxyService sshProxyService,
BuildLogger buildLogger,
com.atlassian.sal.api.message.I18nResolver i18nResolver,
TrustedKeyHelper trustedKeyHelper) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterRepositoryAccess(GitRepositoryAccessData accessData) |
protected GitRepositoryAccessData |
beforeRepositoryAccess(GitRepositoryAccessData accessData)
Wrap with proxy if needed.
|
String |
checkout(File cacheDirectory,
File sourceDirectory,
String targetRevision,
String ignored) |
boolean |
checkRevisionExistsInCacheRepository(File repositoryDirectory,
String targetRevision) |
protected void |
closeProxy(GitRepositoryAccessData accessData) |
String |
commit(File sourceDirectory,
String message,
String committerName,
String committerEmail,
boolean stageModifications) |
void |
createBranch(File sourceDirectory,
String branchName) |
static File |
createCredentialsFile(String repositoryUrlWithPassword) |
void |
createLightweightTag(File sourceDirectory,
String tagName,
String revision) |
BuildRepositoryChanges |
extractCommits(File cacheDirectory,
String startingRevision,
String endingRevision) |
BuildRepositoryChanges |
extractCommits(File cacheDirectory,
String startingRevision,
String endingRevision,
String path) |
BuildRepositoryChanges |
extractCommitsBetweenBranches(File cacheDirectory,
VcsBranch otherBranch,
boolean limitChangeList) |
void |
fetch(File sourceDirectory,
HashAndSource hashAndSource,
boolean useShallow) |
void |
fetch(File sourceDirectory,
String targetBranchOrRevision,
boolean useShallow) |
Optional<String> |
getBranchForSha(File sourceDirectory,
String revision,
String configuredBranch) |
CommitContext |
getCommit(File directory,
String targetRevision)
Gets the commit for the revision, given a working directory.
|
String |
getCurrentBranch(File checkoutPath) |
String |
getCurrentRevision(File sourceDirectory) |
List<VcsBranch> |
getOpenBranches(GitRepositoryAccessData repositoryData,
File workingDir) |
String |
getShaOfRefIfExists(File sourceDirectory,
String ref) |
com.google.common.collect.ImmutableMap<String,String> |
identificationVariables(String name,
String email) |
boolean |
isAncestor(Path gitWorkspace,
GitHash rev1,
GitHash rev2)
Returns true if you can reach rev1 by following parent relationship starting from rev2.
|
boolean |
isClean(File sourceDirectory) |
boolean |
merge(File workspaceDir,
String targetRevision,
String committerName,
String committerEmail) |
Pair<Boolean,String> |
mergeAndReturnHead(File workspaceDir,
String currentRevision,
String targetRevision,
String committerName,
String committerEmail) |
HashAndSource |
obtainLatestRevision() |
Optional<GitHash> |
obtainLatestRevision(File repositoryDirectory,
GitRef ref,
String path) |
void |
pushBranchOrTag(File sourceDirectory,
String refName) |
void |
pushRevision(File sourceDirectory,
String revision,
String currentBranch) |
void |
stageChanges(File sourceDirectory,
Collection<String> filePaths) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcommitpublic static final GitRef ALL_REFS
protected SshProxyService sshProxyService
public NativeGitOperationHelper(@NotNull
GitRepository repository,
@NotNull
GitRepositoryAccessData accessData,
@NotNull
SshProxyService sshProxyService,
@NotNull
BuildLogger buildLogger,
@NotNull
com.atlassian.sal.api.message.I18nResolver i18nResolver,
@NotNull
TrustedKeyHelper trustedKeyHelper)
throws RepositoryException
RepositoryExceptionpublic NativeGitOperationHelper(@NotNull
AbstractGitExecutor repository,
@NotNull
GitRepositoryAccessData accessData,
@NotNull
SshProxyService sshProxyService,
@NotNull
BuildLogger buildLogger,
@NotNull
com.atlassian.sal.api.message.I18nResolver i18nResolver,
@NotNull
TrustedKeyHelper trustedKeyHelper)
throws RepositoryException
RepositoryExceptionpublic void pushRevision(@NotNull
File sourceDirectory,
@NotNull
String revision,
@Nullable
String currentBranch)
throws RepositoryException
pushRevision in interface GitOperationHelperRepositoryExceptionpublic void pushBranchOrTag(@NotNull
File sourceDirectory,
@NotNull
String refName)
throws RepositoryException
pushBranchOrTag in interface GitOperationHelperRepositoryException@NotNull public String commit(@NotNull File sourceDirectory, @NotNull String message, @NotNull String committerName, @NotNull String committerEmail, boolean stageModifications) throws RepositoryException
commit in interface GitOperationHelperRepositoryExceptionpublic void stageChanges(@NotNull
File sourceDirectory,
@NotNull
Collection<String> filePaths)
throws RepositoryException
stageChanges in interface GitOperationHelperRepositoryExceptionpublic com.google.common.collect.ImmutableMap<String,String> identificationVariables(@NotNull String name, @NotNull String email)
protected GitRepositoryAccessData beforeRepositoryAccess(@NotNull GitRepositoryAccessData accessData) throws RepositoryException
RepositoryException@NotNull public static File createCredentialsFile(String repositoryUrlWithPassword) throws IOException
IOExceptionprotected void afterRepositoryAccess(@NotNull
GitRepositoryAccessData accessData)
throws RepositoryException
RepositoryExceptionpublic boolean merge(@NotNull
File workspaceDir,
@NotNull
String targetRevision,
@NotNull
String committerName,
@NotNull
String committerEmail)
throws RepositoryException
merge in interface GitOperationHelperRepositoryExceptionpublic Pair<Boolean,String> mergeAndReturnHead(@NotNull File workspaceDir, @NotNull String currentRevision, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail) throws RepositoryException
mergeAndReturnHead in interface GitOperationHelperRepositoryExceptionprotected void closeProxy(@NotNull
GitRepositoryAccessData accessData)
@NotNull public String checkout(@Nullable File cacheDirectory, @NotNull File sourceDirectory, @NotNull String targetRevision, @Nullable String ignored) throws RepositoryException
checkout in interface GitOperationHelperRepositoryExceptionpublic void fetch(@NotNull
File sourceDirectory,
@NotNull
String targetBranchOrRevision,
boolean useShallow)
throws RepositoryException
fetch in interface GitOperationHelperRepositoryExceptionpublic void fetch(@NotNull
File sourceDirectory,
@NotNull
HashAndSource hashAndSource,
boolean useShallow)
throws RepositoryException
fetch in interface GitOperationHelperRepositoryException@NotNull public List<VcsBranch> getOpenBranches(@NotNull GitRepositoryAccessData repositoryData, File workingDir) throws RepositoryException
getOpenBranches in interface GitOperationHelperRepositoryException@NotNull public Optional<String> getBranchForSha(@NotNull File sourceDirectory, String revision, String configuredBranch) throws RepositoryException
getBranchForSha in interface GitOperationHelperRepositoryExceptionpublic Optional<GitHash> obtainLatestRevision(@NotNull File repositoryDirectory, GitRef ref, String path) throws RepositoryException
obtainLatestRevision in interface GitOperationHelperRepositoryExceptionpublic boolean isAncestor(@NotNull
Path gitWorkspace,
@NotNull
GitHash rev1,
@NotNull
GitHash rev2)
throws RepositoryException
GitOperationHelperisAncestor in interface GitOperationHelperRepositoryException@NotNull public String getCurrentRevision(@NotNull File sourceDirectory) throws RepositoryException
getCurrentRevision in interface GitOperationHelperRepositoryExceptionpublic String getCurrentBranch(@NotNull File checkoutPath) throws RepositoryException
getCurrentBranch in interface GitOperationHelperRepositoryExceptionpublic boolean isClean(@NotNull
File sourceDirectory)
throws RepositoryException
isClean in interface GitOperationHelperRepositoryException@Nullable public String getShaOfRefIfExists(@NotNull File sourceDirectory, @NotNull String ref)
getShaOfRefIfExists in interface GitOperationHelper@NotNull public HashAndSource obtainLatestRevision() throws RepositoryException
obtainLatestRevision in interface GitOperationHelperRepositoryExceptionpublic boolean checkRevisionExistsInCacheRepository(@NotNull
File repositoryDirectory,
@NotNull
String targetRevision)
throws RepositoryException
checkRevisionExistsInCacheRepository in interface GitOperationHelperRepositoryException@NotNull public CommitContext getCommit(File directory, String targetRevision) throws RepositoryException
GitOperationHelpergetCommit in interface GitOperationHelperRepositoryException - if the revision can't be foundpublic BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull String startingRevision, String endingRevision) throws RepositoryException
extractCommits in interface GitOperationHelperRepositoryExceptionpublic BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull String startingRevision, String endingRevision, @Nullable String path) throws RepositoryException
extractCommits in interface GitOperationHelperRepositoryExceptionpublic BuildRepositoryChanges extractCommitsBetweenBranches(File cacheDirectory, VcsBranch otherBranch, boolean limitChangeList) throws RepositoryException
extractCommitsBetweenBranches in interface GitOperationHelperRepositoryExceptionpublic void createBranch(@NotNull
File sourceDirectory,
@NotNull
String branchName)
throws RepositoryException
createBranch in interface GitOperationHelperRepositoryExceptionpublic void createLightweightTag(@NotNull
File sourceDirectory,
@NotNull
String tagName,
@NotNull
String revision)
throws RepositoryException
createLightweightTag in interface GitOperationHelperRepositoryExceptionCopyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.