本文整理匯總了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());
}