本文整理汇总了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);
}
}