public class GitHelper extends Object
| Constructor and Description |
|---|
GitHelper() |
| Modifier and Type | Method and Description |
|---|---|
static org.eclipse.jgit.revwalk.RevCommit |
getCommitForString(org.eclipse.jgit.api.Git git,
String commitId)
Gets a commit for a given string with no body
|
static org.eclipse.jgit.revwalk.RevCommit |
getLatestCommit(org.eclipse.jgit.api.Git git,
String branchName)
Gets the latest commit for a branch
|
static org.eclipse.jgit.lib.Ref |
getLocalBranch(org.eclipse.jgit.api.Git git,
String branchName)
Gets a reference to a local branch with the given name
|
static org.eclipse.jgit.lib.Ref |
getRemoteBranch(org.eclipse.jgit.api.Git git,
String branchName)
Gets a reference to a remote branch with the given name
|
static boolean |
isMergedInto(org.eclipse.jgit.api.Git git,
org.eclipse.jgit.revwalk.RevCommit commit,
String branchName)
Checks to see if a specific commit is merged into a branch
|
static boolean |
isMergedInto(org.eclipse.jgit.api.Git git,
String commitString,
String baseBranch)
Checks to see if one branch is merged into another
|
static List<org.eclipse.jgit.lib.Ref> |
listBranchesWithPrefix(org.eclipse.jgit.api.Git git,
String prefix)
Gets a list of branch references that begin with the given prefix
|
static boolean |
localBranchBehindRemote(org.eclipse.jgit.api.Git git,
String branch,
JGitFlowReporter reporter) |
static boolean |
localBranchExists(org.eclipse.jgit.api.Git git,
String branchName)
Checks to see if a local branch with the given name exists
|
static boolean |
remoteBranchExists(org.eclipse.jgit.api.Git git,
String branch,
JGitFlowReporter reporter)
Checks to see if a remote branch with the given name exists
|
static boolean |
tagExists(org.eclipse.jgit.api.Git git,
String tagName)
Tests to see if a tag exists with the given name
|
static CleanStatus |
workingTreeIsClean(org.eclipse.jgit.api.Git git,
boolean allowUntracked,
JGitFlowReporter reporter)
Tests to see if a working folder is clean.
|
public static boolean isMergedInto(org.eclipse.jgit.api.Git git,
String commitString,
String baseBranch)
throws LocalBranchMissingException,
JGitFlowIOException,
JGitFlowGitAPIException
git - The git instance to usecommitString - The name of the commit we're testingbaseBranch - The name of the base branch to look for the mergeLocalBranchMissingExceptionJGitFlowIOExceptionJGitFlowGitAPIExceptionpublic static org.eclipse.jgit.revwalk.RevCommit getCommitForString(org.eclipse.jgit.api.Git git,
String commitId)
throws JGitFlowIOException,
LocalBranchMissingException
git - The git instance to usecommitId - The name of the commit to findJGitFlowIOExceptionLocalBranchMissingExceptionpublic static boolean isMergedInto(org.eclipse.jgit.api.Git git,
org.eclipse.jgit.revwalk.RevCommit commit,
String branchName)
throws JGitFlowGitAPIException,
JGitFlowIOException
git - The git instance to usecommit - The commit to testbranchName - The name of the base branch to look for the mergeJGitFlowGitAPIExceptionJGitFlowIOExceptionpublic static org.eclipse.jgit.revwalk.RevCommit getLatestCommit(org.eclipse.jgit.api.Git git,
String branchName)
throws JGitFlowIOException
git - The git instance to usebranchName - The name of the branch to find the commit onJGitFlowIOExceptionpublic static boolean localBranchExists(org.eclipse.jgit.api.Git git,
String branchName)
throws JGitFlowGitAPIException
git - The git instance to usebranchName - The name of the branch to look forJGitFlowGitAPIExceptionpublic static boolean remoteBranchExists(org.eclipse.jgit.api.Git git,
String branch,
JGitFlowReporter reporter)
throws JGitFlowGitAPIException
git - The git instance to usebranch - The name of the branch to look forJGitFlowGitAPIExceptionpublic static boolean localBranchBehindRemote(org.eclipse.jgit.api.Git git,
String branch,
JGitFlowReporter reporter)
throws JGitFlowIOException
JGitFlowIOExceptionpublic static org.eclipse.jgit.lib.Ref getRemoteBranch(org.eclipse.jgit.api.Git git,
String branchName)
throws JGitFlowIOException
git - The git instance to usebranchName - The name of the remote branchJGitFlowIOExceptionpublic static org.eclipse.jgit.lib.Ref getLocalBranch(org.eclipse.jgit.api.Git git,
String branchName)
throws JGitFlowIOException
git - The git instance to usebranchName - The name of the remote branchJGitFlowIOExceptionpublic static List<org.eclipse.jgit.lib.Ref> listBranchesWithPrefix(org.eclipse.jgit.api.Git git, String prefix) throws JGitFlowGitAPIException
git - The git instance to useprefix - The prefix to test forJGitFlowGitAPIExceptionpublic static CleanStatus workingTreeIsClean(org.eclipse.jgit.api.Git git, boolean allowUntracked, JGitFlowReporter reporter) throws JGitFlowIOException, JGitFlowGitAPIException
git - The git instance to useallowUntracked - reporter - @return if the branch is clean or notJGitFlowIOExceptionJGitFlowGitAPIExceptionpublic static boolean tagExists(org.eclipse.jgit.api.Git git,
String tagName)
throws JGitFlowGitAPIException
git - The git instance to usetagName - The name of the tag to test forJGitFlowGitAPIExceptionCopyright © 2013 Atlassian. All Rights Reserved.