public abstract class CommitUtils extends Object
This class provides helpers for finding the commits that branches and tags reference.
| Constructor and Description |
|---|
CommitUtils() |
| Modifier and Type | Method and Description |
|---|---|
static org.eclipse.jgit.revwalk.RevCommit |
getBase(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectId... commits)
Get the common base commit of the given commits.
|
static org.eclipse.jgit.revwalk.RevCommit |
getBase(org.eclipse.jgit.lib.Repository repository,
String... revisions)
Get the common base commit between the given revisions.
|
static Collection<org.eclipse.jgit.revwalk.RevCommit> |
getBranches(org.eclipse.jgit.lib.Repository repository)
Get all the commits that branches in the given repository reference.
|
static org.eclipse.jgit.revwalk.RevCommit |
getCommit(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectId commitId)
Get the commit with the given id
|
static org.eclipse.jgit.revwalk.RevCommit |
getCommit(org.eclipse.jgit.lib.Repository repository,
String revision)
Get the commit that the revision references.
|
static org.eclipse.jgit.revwalk.RevCommit |
getHead(org.eclipse.jgit.lib.Repository repository)
Get the HEAD commit in the given repository.
|
static org.eclipse.jgit.revwalk.RevCommit |
getLastCommit(org.eclipse.jgit.lib.Repository repository,
String path)
Find the commit that last changed the given path starting at the commit
that HEAD currently points to
|
static org.eclipse.jgit.revwalk.RevCommit |
getLastCommit(org.eclipse.jgit.lib.Repository repository,
String revision,
String path)
Find the commit that last changed the given path starting with the commit
at the given revision
|
static org.eclipse.jgit.revwalk.RevCommit |
getMaster(org.eclipse.jgit.lib.Repository repository)
Get the commit at the tip of the master branch in the given repository.
|
static org.eclipse.jgit.revwalk.RevCommit |
getRef(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.Ref ref)
Get the commit for the given reference.
|
static org.eclipse.jgit.revwalk.RevCommit |
getRef(org.eclipse.jgit.lib.Repository repository,
String refName)
Get the commit that the given name references.
|
static Collection<org.eclipse.jgit.revwalk.RevCommit> |
getTags(org.eclipse.jgit.lib.Repository repository)
Get all the commits that tags in the given repository reference.
|
protected static org.eclipse.jgit.revwalk.RevCommit |
parse(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectId commit)
Parse a commit from the repository
|
protected static org.eclipse.jgit.revwalk.RevCommit |
parse(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectReader reader,
org.eclipse.jgit.lib.ObjectId commit)
Parse a commit from the object reader
|
protected static org.eclipse.jgit.lib.ObjectId |
resolve(org.eclipse.jgit.lib.Repository repository,
String revision)
Resolve the revision string to a commit object id
|
protected static org.eclipse.jgit.lib.ObjectId |
strictResolve(org.eclipse.jgit.lib.Repository repository,
String revision)
Resolve the revision string to a commit object id.
|
public static org.eclipse.jgit.revwalk.RevCommit getCommit(org.eclipse.jgit.lib.Repository repository,
String revision)
repository - revision - public static org.eclipse.jgit.revwalk.RevCommit getCommit(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectId commitId)
repository - commitId - public static org.eclipse.jgit.revwalk.RevCommit getHead(org.eclipse.jgit.lib.Repository repository)
repository - public static org.eclipse.jgit.revwalk.RevCommit getMaster(org.eclipse.jgit.lib.Repository repository)
repository - public static org.eclipse.jgit.revwalk.RevCommit getBase(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectId... commits)
repository - commits - public static org.eclipse.jgit.revwalk.RevCommit getBase(org.eclipse.jgit.lib.Repository repository,
String... revisions)
repository - revisions - public static org.eclipse.jgit.revwalk.RevCommit getRef(org.eclipse.jgit.lib.Repository repository,
String refName)
repository - refName - public static org.eclipse.jgit.revwalk.RevCommit getRef(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.Ref ref)
repository - ref - public static Collection<org.eclipse.jgit.revwalk.RevCommit> getTags(org.eclipse.jgit.lib.Repository repository)
repository - public static Collection<org.eclipse.jgit.revwalk.RevCommit> getBranches(org.eclipse.jgit.lib.Repository repository)
repository - protected static org.eclipse.jgit.lib.ObjectId resolve(org.eclipse.jgit.lib.Repository repository,
String revision)
repository - revision - protected static org.eclipse.jgit.lib.ObjectId strictResolve(org.eclipse.jgit.lib.Repository repository,
String revision)
A GitException will be thrown when the revision can not be
resolved to an ObjectId
repository - revision - protected static org.eclipse.jgit.revwalk.RevCommit parse(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectId commit)
repository - commit - protected static org.eclipse.jgit.revwalk.RevCommit parse(org.eclipse.jgit.lib.Repository repository,
org.eclipse.jgit.lib.ObjectReader reader,
org.eclipse.jgit.lib.ObjectId commit)
repository - reader - commit - public static org.eclipse.jgit.revwalk.RevCommit getLastCommit(org.eclipse.jgit.lib.Repository repository,
String path)
repository - path - public static org.eclipse.jgit.revwalk.RevCommit getLastCommit(org.eclipse.jgit.lib.Repository repository,
String revision,
String path)
repository - revision - path - Copyright © 2011-2018. All Rights Reserved.