Package org.kohsuke.github
Class GHBranch
java.lang.Object
org.kohsuke.github.GHBranch
A branch in a repository.
- Author:
- Yusuke Kokubo
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidDisables branch protection and allows anyone with push access to push changes.Enables branch protection to control what commit statuses are required to push.voidenableProtection(EnforcementLevel level, Collection<String> contexts) Deprecated.getName()Gets name.getOwner()Gets owner.Gets protection.Gets protection url.getRoot()Deprecated.getSHA1()Gets sha 1.booleanIs protected boolean.Merge a ref into this branch.Merge a branch into this branch.toString()To string.
-
Method Details
-
getOwner
Gets owner.- Returns:
- the repository that this branch is in.
-
getName
Gets name.- Returns:
- the name
-
isProtected
public boolean isProtected()Is protected boolean.- Returns:
- true if the push to this branch is restricted via branch protection.
-
getProtectionUrl
Gets protection url.- Returns:
- API URL that deals with the protection of this branch.
-
getProtection
Gets protection.- Returns:
- the protection
- Throws:
IOException- the io exception
-
getSHA1
Gets sha 1.- Returns:
- The SHA1 of the commit that this branch currently points to.
-
disableProtection
Disables branch protection and allows anyone with push access to push changes.- Throws:
IOException- if disabling protection fails
-
enableProtection
Enables branch protection to control what commit statuses are required to push.- Returns:
- GHBranchProtectionBuilder for enabling protection
- See Also:
-
enableProtection
@Deprecated public void enableProtection(EnforcementLevel level, Collection<String> contexts) throws IOException Deprecated.Enable protection.- Parameters:
level- the levelcontexts- the contexts- Throws:
IOException- the io exception
-
merge
Merge a branch into this branch.- Parameters:
headBranch- the branch whose head will be mergedcommitMessage- the commit message- Returns:
- the merge
GHCommitcreated, ornullif the base already contains the head (nothing to merge). - Throws:
IOException- if merging fails
-
merge
Merge a ref into this branch.- Parameters:
head- the ref name that will be merged into this branch. Follows the usual ref naming rules, could be a branch name, tag, or commit sha.commitMessage- the commit message- Returns:
- the merge
GHCommitcreated, ornullif the base already contains the head (nothing to merge). - Throws:
IOException- if merging fails
-
toString
To string. -
getRoot
Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.Get the rootGitHubinstance for this object.- Returns:
- the root
GitHubinstance
-
GitHubinstance, use a local copy instead of pulling it out of objects.