本文整理匯總了Java中org.eclipse.jgit.revwalk.RevWalk.next方法的典型用法代碼示例。如果您正苦於以下問題:Java RevWalk.next方法的具體用法?Java RevWalk.next怎麽用?Java RevWalk.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jgit.revwalk.RevWalk
的用法示例。
在下文中一共展示了RevWalk.next方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSingleBaseCommit
import org.eclipse.jgit.revwalk.RevWalk; //導入方法依賴的package包/類
private GitRevisionInfo getSingleBaseCommit (RevWalk walk, List<RevCommit> commits) throws IOException {
while (commits.size() > 1) {
walk.reset();
for (RevCommit c : commits) {
walk.markStart(walk.parseCommit(c));
}
walk.setRevFilter(RevFilter.MERGE_BASE);
commits.clear();
for (RevCommit commit = walk.next(); commit != null; commit = walk.next()) {
commits.add(commit);
}
}
if (commits.isEmpty()) {
return null;
} else {
return getClassFactory().createRevisionInfo(commits.get(0), getRepository());
}
}
示例2: getCommonAncestor
import org.eclipse.jgit.revwalk.RevWalk; //導入方法依賴的package包/類
/**
* Finds the common base for the given commit "a" and the given commit "b"
*
* @param walk
* - used to browse through commits
* @param a
* - commit "a"
* @param b
* - commit "b"
* @return the bese commit
* @throws IncorrectObjectTypeException
* @throws IOException
*/
private RevCommit getCommonAncestor(RevWalk walk, RevCommit a, RevCommit b)
throws IOException {
walk.reset();
walk.setRevFilter(RevFilter.MERGE_BASE);
walk.markStart(a);
walk.markStart(b);
final RevCommit base = walk.next();
if (base == null)
return null;
final RevCommit base2 = walk.next();
if (base2 != null) {
throw new NoMergeBaseException(MergeBaseFailureReason.MULTIPLE_MERGE_BASES_NOT_SUPPORTED,
MessageFormat.format(JGitText.get().multipleMergeBasesFor, a.name(), b.name(), base.name(), base2.name()));
}
return base;
}
示例3: getSrcCommit
import org.eclipse.jgit.revwalk.RevWalk; //導入方法依賴的package包/類
public RevCommit getSrcCommit() {
try {
RevWalk revWalk = new RevWalk(git.getRepository());
AnyObjectId headId = git.getRepository().resolve(Constants.HEAD);
RevCommit root = revWalk.parseCommit(headId);
revWalk.sort(RevSort.REVERSE);
revWalk.markStart(root);
return revWalk.next();
} catch (Exception e) {
throw new RuntimeException(e);
}
}