public class GitUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULD_REPO_NAME |
| Constructor and Description |
|---|
GitUtils(hudson.model.TaskListener listener,
IGitAPI git) |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildBranch(hudson.model.AbstractBuild<?,?> build,
String repository,
String branchName)
Builds branch based on params.Applied build params if any.
|
static void |
buildBranchEnvVar(hudson.model.AbstractBuild<?,?> build,
Map<String,String> env,
List<org.eclipse.jgit.transport.RemoteConfig> repositories,
List<BranchSpec> branches)
Builds branch envvars.
|
Collection<Revision> |
filterTipBranches(Collection<Revision> revisions)
Return a list of 'tip' branches (I.E.
|
static String[] |
fixupNames(String[] names,
String[] urls) |
Collection<Revision> |
getAllBranchRevisions()
Return a list of "Revisions" - where a revision knows about all the branch names that refer to
a SHA1.
|
static hudson.EnvVars |
getPollEnvironment(hudson.model.AbstractProject p,
hudson.FilePath ws,
hudson.Launcher launcher,
hudson.model.TaskListener listener,
boolean pollSlaves)
An attempt to generate at least semi-useful EnvVars for polling calls, based on previous build.
|
Revision |
getRevisionContainingBranch(String branchName)
Return the revision containing the branch name.
|
Revision |
getRevisionForSHA1(org.eclipse.jgit.lib.ObjectId sha1) |
static String |
getSingleBranch(hudson.model.AbstractBuild<?,?> build,
List<org.eclipse.jgit.transport.RemoteConfig> repositories,
List<BranchSpec> branches)
If the configuration is such that we are tracking just one branch of one repository
return that branch specifier (in the form of something like "origin/master"
Otherwise return null.
|
static boolean |
isEmpty(String[] urls)
Verifies whether array of the repository Urls is empty.
|
static boolean |
isEqualArray(Object[] o1,
Object[] o2)
Verifies if first array equals second without ordering.
|
static boolean |
isEqualCollection(Collection c1,
Collection c2)
Verifies if first collection equals second without ordering.
|
public static final String DEFAULD_REPO_NAME
public GitUtils(hudson.model.TaskListener listener,
IGitAPI git)
public Collection<Revision> getAllBranchRevisions() throws GitException, IOException
IOExceptionGitExceptionpublic Revision getRevisionContainingBranch(String branchName) throws GitException, IOException
branchName - IOExceptionGitExceptionpublic Revision getRevisionForSHA1(org.eclipse.jgit.lib.ObjectId sha1) throws GitException, IOException
GitExceptionIOExceptionpublic Collection<Revision> filterTipBranches(Collection<Revision> revisions)
git - public static hudson.EnvVars getPollEnvironment(hudson.model.AbstractProject p,
hudson.FilePath ws,
hudson.Launcher launcher,
hudson.model.TaskListener listener,
boolean pollSlaves)
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic static void buildBranchEnvVar(hudson.model.AbstractBuild<?,?> build,
Map<String,String> env,
List<org.eclipse.jgit.transport.RemoteConfig> repositories,
List<BranchSpec> branches)
GitSCM.GIT_BRANCH will be used.build - AbstractBuildenv - environment variables.repositories - list of repos.branches - list of BranchSpecpublic static String getSingleBranch(hudson.model.AbstractBuild<?,?> build, List<org.eclipse.jgit.transport.RemoteConfig> repositories, List<BranchSpec> branches)
public static String buildBranch(hudson.model.AbstractBuild<?,?> build, String repository, String branchName)
build - AbstractBuildrepository - repo namebranchName - branch namepublic static boolean isEmpty(String[] urls)
urls - repository Urls.public static boolean isEqualCollection(Collection c1, Collection c2)
c1 - collectionc2 - collectionCopyright © 2004-2015 Hudson. All Rights Reserved.