com.atlassian.bamboo.plugins.git
Class JGitOperationHelper
java.lang.Object
com.atlassian.bamboo.plugins.git.AbstractGitOperationHelper
com.atlassian.bamboo.plugins.git.JGitOperationHelper
- All Implemented Interfaces:
- GitOperationHelper
public class JGitOperationHelper
- extends AbstractGitOperationHelper
Method Summary |
String |
checkout(File cacheDirectory,
File sourceDirectory,
String targetRevision,
String previousRevision)
|
boolean |
checkRevisionExistsInCacheRepository(File repositoryDirectory,
String targetRevision)
|
String |
commit(File sourceDirectory,
String message,
String comitterName,
String comitterEmail)
|
protected org.eclipse.jgit.lib.Repository |
createLocalRepository(File workingDirectory,
File cacheDirectory)
|
BuildRepositoryChanges |
extractCommits(File directory,
String previousRevision,
String targetRevision)
|
void |
fetch(File sourceDirectory,
String targetRevision,
boolean useShallow)
|
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 |
getCurrentRevision(File sourceDirectory)
|
List<VcsBranch> |
getOpenBranches(GitRepositoryAccessData repositoryData,
File workingDir)
|
protected String |
getRevision(File sourceDirectory,
String revision)
|
String |
getRevisionIfExists(File sourceDirectory,
String revision)
|
boolean |
merge(File workspaceDir,
String targetRevision,
String committerName,
String committerEmail)
|
String |
obtainLatestRevision()
|
void |
pushRevision(File sourceDirectory,
String revision)
Pushes arbitrary revision (refspec?) back to the upstream repo. |
protected static org.eclipse.jgit.lib.Ref |
resolveRefSpec(String name,
org.eclipse.jgit.transport.FetchConnection fetchConnection)
|
protected
|
withFetchConnection(org.eclipse.jgit.lib.Repository repository,
GitRepositoryAccessData accessData,
JGitOperationHelper.WithFetchConnectionCallback<E,T> callback)
|
protected
|
withFetchConnection(org.eclipse.jgit.transport.Transport transport,
JGitOperationHelper.WithFetchConnectionCallback<E,T> callback)
|
protected
|
withTransport(org.eclipse.jgit.lib.Repository repository,
GitRepositoryAccessData accessData,
JGitOperationHelper.WithTransportCallback<E,T> callback)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JGitOperationHelper
public JGitOperationHelper(GitRepositoryAccessData accessData,
@NotNull
BuildLogger buildLogger,
@NotNull
com.atlassian.sal.api.message.I18nResolver i18nResolver)
commit
public String commit(@NotNull
File sourceDirectory,
@NotNull
String message,
@NotNull
String comitterName,
@NotNull
String comitterEmail)
throws RepositoryException
- Throws:
RepositoryException
merge
public boolean merge(@NotNull
File workspaceDir,
@NotNull
String targetRevision,
@NotNull
String committerName,
@NotNull
String committerEmail)
pushRevision
public void pushRevision(@NotNull
File sourceDirectory,
@NotNull
String revision)
throws RepositoryException
- Pushes arbitrary revision (refspec?) back to the upstream repo.
- Throws:
RepositoryException
checkout
@NotNull
public String checkout(@Nullable
File cacheDirectory,
@NotNull
File sourceDirectory,
@NotNull
String targetRevision,
@Nullable
String previousRevision)
throws RepositoryException
- Throws:
RepositoryException
fetch
public void fetch(@NotNull
File sourceDirectory,
@NotNull
String targetRevision,
boolean useShallow)
throws RepositoryException
- Throws:
RepositoryException
getCurrentRevision
@NotNull
public String getCurrentRevision(@NotNull
File sourceDirectory)
throws RepositoryException
- Throws:
RepositoryException
getRevision
protected String getRevision(File sourceDirectory,
@NotNull
String revision)
throws RepositoryException
- Throws:
RepositoryException
getRevisionIfExists
@Nullable
public String getRevisionIfExists(@NotNull
File sourceDirectory,
@NotNull
String revision)
obtainLatestRevision
@NotNull
public String obtainLatestRevision()
throws RepositoryException
- Throws:
RepositoryException
getOpenBranches
@NotNull
public List<VcsBranch> getOpenBranches(@NotNull
GitRepositoryAccessData repositoryData,
File workingDir)
throws RepositoryException
- Throws:
RepositoryException
checkRevisionExistsInCacheRepository
public boolean checkRevisionExistsInCacheRepository(@NotNull
File repositoryDirectory,
@NotNull
String targetRevision)
throws IOException,
RepositoryException
- Parameters:
repositoryDirectory
- directory where repository is fetchedtargetRevision
- revision to find in repository
- Returns:
- true if revision found
- Throws:
IOException
- thrown when revision not found (MissingObjectException)
RepositoryException
resolveRefSpec
@Nullable
protected static org.eclipse.jgit.lib.Ref resolveRefSpec(String name,
org.eclipse.jgit.transport.FetchConnection fetchConnection)
createLocalRepository
protected org.eclipse.jgit.lib.Repository createLocalRepository(File workingDirectory,
@Nullable
File cacheDirectory)
throws IOException
- Throws:
IOException
extractCommits
public BuildRepositoryChanges extractCommits(@NotNull
File directory,
@Nullable
String previousRevision,
@Nullable
String targetRevision)
throws RepositoryException
- Throws:
RepositoryException
getBranchForSha
@NotNull
public String getBranchForSha(@NotNull
File sourceDirectory,
String revision,
String configuredBranch)
throws RepositoryException
- Throws:
RepositoryException
getCommit
@NotNull
public CommitContext getCommit(File directory,
String targetRevision)
throws RepositoryException
- Description copied from interface:
GitOperationHelper
- Gets the commit for the revision, given a working directory.
- Throws:
RepositoryException
- if the revision can't be found
withTransport
@Nullable
protected <E extends Throwable,T> T withTransport(@NotNull
org.eclipse.jgit.lib.Repository repository,
@NotNull
GitRepositoryAccessData accessData,
@NotNull
JGitOperationHelper.WithTransportCallback<E,T> callback)
throws E extends Throwable,
RepositoryException
- Throws:
E extends Throwable
RepositoryException
withFetchConnection
protected <E extends Throwable,T> T withFetchConnection(@NotNull
org.eclipse.jgit.transport.Transport transport,
@NotNull
JGitOperationHelper.WithFetchConnectionCallback<E,T> callback)
throws E extends Throwable,
org.eclipse.jgit.errors.NotSupportedException,
org.eclipse.jgit.errors.TransportException
- Throws:
E extends Throwable
org.eclipse.jgit.errors.NotSupportedException
org.eclipse.jgit.errors.TransportException
withFetchConnection
protected <E extends Throwable,T> T withFetchConnection(@NotNull
org.eclipse.jgit.lib.Repository repository,
@NotNull
GitRepositoryAccessData accessData,
@NotNull
JGitOperationHelper.WithFetchConnectionCallback<E,T> callback)
throws E extends Throwable,
RepositoryException,
org.eclipse.jgit.errors.NotSupportedException,
org.eclipse.jgit.errors.TransportException
- Throws:
E extends Throwable
RepositoryException
org.eclipse.jgit.errors.NotSupportedException
org.eclipse.jgit.errors.TransportException
Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.