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, wait
commit
public 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
RepositoryException
public 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
RepositoryException
public void pushRevision(@NotNull File sourceDirectory, @NotNull String revision, @Nullable String currentBranch) throws RepositoryException
pushRevision
in interface GitOperationHelper
RepositoryException
public void pushBranchOrTag(@NotNull File sourceDirectory, @NotNull String refName) throws RepositoryException
pushBranchOrTag
in interface GitOperationHelper
RepositoryException
@NotNull public String commit(@NotNull File sourceDirectory, @NotNull String message, @NotNull String committerName, @NotNull String committerEmail, boolean stageModifications) throws RepositoryException
commit
in interface GitOperationHelper
RepositoryException
public void stageChanges(@NotNull File sourceDirectory, @NotNull Collection<String> filePaths) throws RepositoryException
stageChanges
in interface GitOperationHelper
RepositoryException
public 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
IOException
protected void afterRepositoryAccess(@NotNull GitRepositoryAccessData accessData) throws RepositoryException
RepositoryException
public boolean merge(@NotNull File workspaceDir, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail) throws RepositoryException
merge
in interface GitOperationHelper
RepositoryException
public Pair<Boolean,String> mergeAndReturnHead(@NotNull File workspaceDir, @NotNull String currentRevision, @NotNull String targetRevision, @NotNull String committerName, @NotNull String committerEmail) throws RepositoryException
mergeAndReturnHead
in interface GitOperationHelper
RepositoryException
protected 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 GitOperationHelper
RepositoryException
public void fetch(@NotNull File sourceDirectory, @NotNull String targetBranchOrRevision, boolean useShallow) throws RepositoryException
fetch
in interface GitOperationHelper
RepositoryException
public void fetch(@NotNull File sourceDirectory, @NotNull HashAndSource hashAndSource, boolean useShallow) throws RepositoryException
fetch
in interface GitOperationHelper
RepositoryException
@NotNull public List<VcsBranch> getOpenBranches(@NotNull GitRepositoryAccessData repositoryData, File workingDir) throws RepositoryException
getOpenBranches
in interface GitOperationHelper
RepositoryException
@NotNull public Optional<String> getBranchForSha(@NotNull File sourceDirectory, String revision, String configuredBranch) throws RepositoryException
getBranchForSha
in interface GitOperationHelper
RepositoryException
public Optional<GitHash> obtainLatestRevision(@NotNull File repositoryDirectory, GitRef ref, String path) throws RepositoryException
obtainLatestRevision
in interface GitOperationHelper
RepositoryException
public boolean isAncestor(@NotNull Path gitWorkspace, @NotNull GitHash rev1, @NotNull GitHash rev2) throws RepositoryException
GitOperationHelper
isAncestor
in interface GitOperationHelper
RepositoryException
@NotNull public String getCurrentRevision(@NotNull File sourceDirectory) throws RepositoryException
getCurrentRevision
in interface GitOperationHelper
RepositoryException
public String getCurrentBranch(@NotNull File checkoutPath) throws RepositoryException
getCurrentBranch
in interface GitOperationHelper
RepositoryException
public boolean isClean(@NotNull File sourceDirectory) throws RepositoryException
isClean
in interface GitOperationHelper
RepositoryException
@Nullable public String getShaOfRefIfExists(@NotNull File sourceDirectory, @NotNull String ref)
getShaOfRefIfExists
in interface GitOperationHelper
@NotNull public HashAndSource obtainLatestRevision() throws RepositoryException
obtainLatestRevision
in interface GitOperationHelper
RepositoryException
public boolean checkRevisionExistsInCacheRepository(@NotNull File repositoryDirectory, @NotNull String targetRevision) throws RepositoryException
checkRevisionExistsInCacheRepository
in interface GitOperationHelper
RepositoryException
@NotNull public CommitContext getCommit(File directory, String targetRevision) throws RepositoryException
GitOperationHelper
getCommit
in interface GitOperationHelper
RepositoryException
- if the revision can't be foundpublic BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull String startingRevision, String endingRevision) throws RepositoryException
extractCommits
in interface GitOperationHelper
RepositoryException
public BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull String startingRevision, String endingRevision, @Nullable String path) throws RepositoryException
extractCommits
in interface GitOperationHelper
RepositoryException
public BuildRepositoryChanges extractCommitsBetweenBranches(File cacheDirectory, VcsBranch otherBranch, boolean limitChangeList) throws RepositoryException
extractCommitsBetweenBranches
in interface GitOperationHelper
RepositoryException
public void createBranch(@NotNull File sourceDirectory, @NotNull String branchName) throws RepositoryException
createBranch
in interface GitOperationHelper
RepositoryException
public void createLightweightTag(@NotNull File sourceDirectory, @NotNull String tagName, @NotNull String revision) throws RepositoryException
createLightweightTag
in interface GitOperationHelper
RepositoryException
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.