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(@NotNull AbstractGitExecutor repository,
@NotNull GitRepositoryAccessData accessData,
@NotNull SshProxyService sshProxyService,
@NotNull BuildLogger buildLogger,
@NotNull com.atlassian.sal.api.message.I18nResolver i18nResolver,
@NotNull TrustedKeyHelper trustedKeyHelper) |
NativeGitOperationHelper(@NotNull GitRepository repository,
@NotNull GitRepositoryAccessData accessData,
@NotNull SshProxyService sshProxyService,
@NotNull BuildLogger buildLogger,
@NotNull com.atlassian.sal.api.message.I18nResolver i18nResolver,
@NotNull TrustedKeyHelper trustedKeyHelper) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterRepositoryAccess(@NotNull GitRepositoryAccessData accessData) |
protected GitRepositoryAccessData |
beforeRepositoryAccess(@NotNull GitRepositoryAccessData accessData)
Wrap with proxy if needed.
|
@NotNull String |
checkout(@Nullable File cacheDirectory,
@NotNull File sourceDirectory,
@NotNull String targetRevision,
@Nullable String ignored) |
boolean |
checkRevisionExistsInCacheRepository(@NotNull File repositoryDirectory,
@NotNull String targetRevision) |
protected void |
closeProxy(@NotNull GitRepositoryAccessData accessData) |
@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) |
static @NotNull File |
createCredentialsFile(String repositoryUrlWithPassword) |
void |
createLightweightTag(@NotNull File sourceDirectory,
@NotNull String tagName,
@NotNull String revision) |
BuildRepositoryChanges |
extractCommits(File cacheDirectory,
@NotNull String startingRevision,
String endingRevision) |
BuildRepositoryChanges |
extractCommits(File cacheDirectory,
@NotNull String startingRevision,
String endingRevision,
@Nullable String path) |
BuildRepositoryChanges |
extractCommitsBetweenBranches(File cacheDirectory,
VcsBranch otherBranch,
boolean limitChangeList) |
void |
fetch(@NotNull File sourceDirectory,
@NotNull HashAndSource hashAndSource,
boolean useShallow) |
void |
fetch(@NotNull File sourceDirectory,
@NotNull HashAndSource hashAndSource,
boolean useShallow,
boolean fetchTagsByDefault) |
void |
fetch(@NotNull File sourceDirectory,
@NotNull String targetBranchOrRevision,
boolean useShallow) |
void |
fetch(@NotNull File sourceDirectory,
@NotNull String targetBranchOrRevision,
boolean useShallow,
boolean fetchTagsByDefault) |
@NotNull Optional<String> |
getBranchForSha(@NotNull File sourceDirectory,
String revision,
String configuredBranch) |
@NotNull CommitContext |
getCommit(File directory,
String targetRevision)
Gets the commit for the revision, given a working directory.
|
String |
getCurrentBranch(@NotNull File checkoutPath) |
@NotNull String |
getCurrentRevision(@NotNull File sourceDirectory) |
@NotNull List<VcsBranch> |
getOpenBranches(@NotNull GitRepositoryAccessData repositoryData,
File workingDir) |
@Nullable String |
getShaOfRefIfExists(@NotNull File sourceDirectory,
@NotNull String ref) |
List<TagAndRevision> |
getTagsForRepository(@NotNull GitRepositoryAccessData accessData) |
com.google.common.collect.ImmutableMap<String,String> |
identificationVariables(@NotNull String name,
@NotNull String email) |
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 |
isClean(@NotNull File sourceDirectory) |
boolean |
merge(@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 HashAndSource |
obtainLatestRevision() |
Optional<GitHash> |
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> 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 @NotNull GitRepository repository, @NotNull @NotNull GitRepositoryAccessData accessData, @NotNull @NotNull SshProxyService sshProxyService, @NotNull @NotNull BuildLogger buildLogger, @NotNull @NotNull com.atlassian.sal.api.message.I18nResolver i18nResolver, @NotNull @NotNull TrustedKeyHelper trustedKeyHelper) throws RepositoryException
RepositoryException
public NativeGitOperationHelper(@NotNull @NotNull AbstractGitExecutor repository, @NotNull @NotNull GitRepositoryAccessData accessData, @NotNull @NotNull SshProxyService sshProxyService, @NotNull @NotNull BuildLogger buildLogger, @NotNull @NotNull com.atlassian.sal.api.message.I18nResolver i18nResolver, @NotNull @NotNull TrustedKeyHelper trustedKeyHelper) throws RepositoryException
RepositoryException
public void pushRevision(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String revision, @Nullable @Nullable String currentBranch) throws RepositoryException
pushRevision
in interface GitOperationHelper
RepositoryException
public void pushBranchOrTag(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String refName) throws RepositoryException
pushBranchOrTag
in interface GitOperationHelper
RepositoryException
@NotNull public @NotNull String commit(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String message, @NotNull @NotNull String committerName, @NotNull @NotNull String committerEmail, boolean stageModifications) throws RepositoryException
commit
in interface GitOperationHelper
RepositoryException
public void stageChanges(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull Collection<String> filePaths) throws RepositoryException
stageChanges
in interface GitOperationHelper
RepositoryException
public com.google.common.collect.ImmutableMap<String,String> identificationVariables(@NotNull @NotNull String name, @NotNull @NotNull String email)
protected GitRepositoryAccessData beforeRepositoryAccess(@NotNull @NotNull GitRepositoryAccessData accessData) throws RepositoryException
RepositoryException
@NotNull public static @NotNull File createCredentialsFile(String repositoryUrlWithPassword) throws IOException
IOException
protected void afterRepositoryAccess(@NotNull @NotNull GitRepositoryAccessData accessData) throws RepositoryException
RepositoryException
public boolean merge(@NotNull @NotNull File workspaceDir, @NotNull @NotNull String targetRevision, @NotNull @NotNull String committerName, @NotNull @NotNull String committerEmail) throws RepositoryException
merge
in interface GitOperationHelper
RepositoryException
public 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
mergeAndReturnHead
in interface GitOperationHelper
RepositoryException
protected void closeProxy(@NotNull @NotNull GitRepositoryAccessData accessData)
@NotNull public @NotNull String checkout(@Nullable @Nullable File cacheDirectory, @NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetRevision, @Nullable @Nullable String ignored) throws RepositoryException
checkout
in interface GitOperationHelper
RepositoryException
public void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetBranchOrRevision, boolean useShallow, boolean fetchTagsByDefault) throws RepositoryException
fetch
in interface GitOperationHelper
RepositoryException
public void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String targetBranchOrRevision, boolean useShallow) throws RepositoryException
fetch
in interface GitOperationHelper
RepositoryException
public void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull HashAndSource hashAndSource, boolean useShallow) throws RepositoryException
fetch
in interface GitOperationHelper
RepositoryException
public void fetch(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull HashAndSource hashAndSource, boolean useShallow, boolean fetchTagsByDefault) throws RepositoryException
fetch
in interface GitOperationHelper
RepositoryException
@NotNull public @NotNull List<VcsBranch> getOpenBranches(@NotNull @NotNull GitRepositoryAccessData repositoryData, File workingDir) throws RepositoryException
getOpenBranches
in interface GitOperationHelper
RepositoryException
@NotNull public @NotNull Optional<String> getBranchForSha(@NotNull @NotNull File sourceDirectory, String revision, String configuredBranch) throws RepositoryException
getBranchForSha
in interface GitOperationHelper
RepositoryException
public Optional<GitHash> obtainLatestRevision(@NotNull @NotNull File repositoryDirectory, GitRef ref, String path) throws RepositoryException
obtainLatestRevision
in interface GitOperationHelper
RepositoryException
public boolean isAncestor(@NotNull @NotNull Path gitWorkspace, @NotNull @NotNull GitHash rev1, @NotNull @NotNull GitHash rev2) throws RepositoryException
GitOperationHelper
isAncestor
in interface GitOperationHelper
RepositoryException
@NotNull public @NotNull String getCurrentRevision(@NotNull @NotNull File sourceDirectory) throws RepositoryException
getCurrentRevision
in interface GitOperationHelper
RepositoryException
public String getCurrentBranch(@NotNull @NotNull File checkoutPath) throws RepositoryException
getCurrentBranch
in interface GitOperationHelper
RepositoryException
public List<TagAndRevision> getTagsForRepository(@NotNull @NotNull GitRepositoryAccessData accessData) throws RepositoryException
getTagsForRepository
in interface GitOperationHelper
RepositoryException
public boolean isClean(@NotNull @NotNull File sourceDirectory) throws RepositoryException
isClean
in interface GitOperationHelper
RepositoryException
@Nullable public @Nullable String getShaOfRefIfExists(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String ref)
getShaOfRefIfExists
in interface GitOperationHelper
@NotNull public @NotNull HashAndSource obtainLatestRevision() throws RepositoryException
obtainLatestRevision
in interface GitOperationHelper
RepositoryException
public boolean checkRevisionExistsInCacheRepository(@NotNull @NotNull File repositoryDirectory, @NotNull @NotNull String targetRevision) throws RepositoryException
checkRevisionExistsInCacheRepository
in interface GitOperationHelper
RepositoryException
@NotNull public @NotNull 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 @NotNull String startingRevision, String endingRevision) throws RepositoryException
extractCommits
in interface GitOperationHelper
RepositoryException
public BuildRepositoryChanges extractCommits(File cacheDirectory, @NotNull @NotNull String startingRevision, String endingRevision, @Nullable @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 @NotNull File sourceDirectory, @NotNull @NotNull String branchName) throws RepositoryException
createBranch
in interface GitOperationHelper
RepositoryException
public void createLightweightTag(@NotNull @NotNull File sourceDirectory, @NotNull @NotNull String tagName, @NotNull @NotNull String revision) throws RepositoryException
createLightweightTag
in interface GitOperationHelper
RepositoryException
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.