本文整理汇总了Java中org.eclipse.jgit.revwalk.RevCommit.getParentCount方法的典型用法代码示例。如果您正苦于以下问题:Java RevCommit.getParentCount方法的具体用法?Java RevCommit.getParentCount怎么用?Java RevCommit.getParentCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.revwalk.RevCommit
的用法示例。
在下文中一共展示了RevCommit.getParentCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detectAtCommit
import org.eclipse.jgit.revwalk.RevCommit; //导入方法依赖的package包/类
public void detectAtCommit(Repository repository, String commitId, StructuralDiffHandler handler) {
File metadataFolder = repository.getDirectory();
File projectFolder = metadataFolder.getParentFile();
GitService gitService = new GitServiceImpl();
//RevWalk walk = new RevWalk(repository);
try (RevWalk walk = new RevWalk(repository)) {
RevCommit commit = walk.parseCommit(repository.resolve(commitId));
if (commit.getParentCount() == 1) {
walk.parseCommit(commit.getParent(0));
this.detectRefactorings(gitService, repository, handler, projectFolder, commit);
}
} catch (Exception e) {
logger.warn(String.format("Ignored revision %s due to error", commitId), e);
handler.handleException(commitId, e);
}
}
示例2: getCommitStatistics
import org.eclipse.jgit.revwalk.RevCommit; //导入方法依赖的package包/类
/** 각 유저가 날짜별로 커밋을 한 정보를 취합함.
* @return
*/
public GitParentStatistics getCommitStatistics(){
GitParentStatistics gitParentStatistics = new GitParentStatistics();
try{
for(RevCommit rc:git.log().all().call()){
String diffs = new String();
ByteArrayOutputStream out = new ByteArrayOutputStream();
if(rc.getParentCount()>0){
DiffFormatter df = new DiffFormatter(out);
df.setRepository(this.localRepo);
df.format(rc.getParent(0), rc);
df.flush();
diffs = out.toString();
} else {
diffs = simpleFileBrowser(rc);
}
int addFile = StringUtils.countOccurrencesOf(diffs, "--- /dev/null");// 추가한 파일 수
int deleteFile = StringUtils.countOccurrencesOf(diffs, "+++ /dev/null");// 삭제한 파일 수
diffs = StringUtils.delete(diffs, "\n--- ");
diffs = StringUtils.delete(diffs, "\n+++ ");
gitParentStatistics.addGitChildStatistics(
new GitChildStatistics(
rc.getAuthorIdent().getEmailAddress(), // 유저 이메일
StringUtils.countOccurrencesOf(diffs, "\n+"), //추가한 라인 수
StringUtils.countOccurrencesOf(diffs, "\n-"), //삭제한 라인 수
addFile,
deleteFile,
rc.getAuthorIdent().getWhen())); // 날짜
}
}catch(Exception e){
System.err.println(e.getMessage());
}
return gitParentStatistics;
}
示例3: include
import org.eclipse.jgit.revwalk.RevCommit; //导入方法依赖的package包/类
@Override
public boolean include(RevWalk walker, RevCommit c) {
return c.getParentCount() >= 2;
}
示例4: include
import org.eclipse.jgit.revwalk.RevCommit; //导入方法依赖的package包/类
@Override
public final boolean include(final RevWalk walker, final RevCommit c) {
return c.getParentCount() == 1 && !isCommitAnalyzed(c.getName());
}