當前位置: 首頁>>代碼示例>>Java>>正文


Java RevCommit.getParentCount方法代碼示例

本文整理匯總了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);
       }
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:17,代碼來源:GitHistoryStructuralDiffAnalyzer.java

示例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;
}
 
開發者ID:forweaver,項目名稱:forweaver2.0,代碼行數:38,代碼來源:GitUtil.java

示例3: include

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
@Override
public boolean include(RevWalk walker, RevCommit c) {
	return c.getParentCount() >= 2;
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:5,代碼來源:RevFilter.java

示例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());
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:5,代碼來源:GitHelper.java


注:本文中的org.eclipse.jgit.revwalk.RevCommit.getParentCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。