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) |
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)
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)
Tests to see if a working folder is clean. e.g. all changes have been committed.
|
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 mergeLocalBranchMissingException
JGitFlowIOException
JGitFlowGitAPIException
public 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 findJGitFlowIOException
LocalBranchMissingException
public 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 mergeJGitFlowGitAPIException
JGitFlowIOException
public 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 onJGitFlowIOException
public 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 forJGitFlowGitAPIException
public static boolean remoteBranchExists(org.eclipse.jgit.api.Git git, String branch) throws JGitFlowGitAPIException
git
- The git instance to usebranch
- The name of the branch to look forJGitFlowGitAPIException
public static boolean localBranchBehindRemote(org.eclipse.jgit.api.Git git, String branch) throws JGitFlowIOException
JGitFlowIOException
public 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 branchJGitFlowIOException
public 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 branchJGitFlowIOException
public 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 forJGitFlowGitAPIException
public static CleanStatus workingTreeIsClean(org.eclipse.jgit.api.Git git, boolean allowUntracked) throws JGitFlowIOException, JGitFlowGitAPIException
git
- The git instance to useallowUntracked
- JGitFlowIOException
JGitFlowGitAPIException
public 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 forJGitFlowGitAPIException
Copyright © 2017 Atlassian. All rights reserved.