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


Java RevCommit.getName方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.revwalk.RevCommit.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java RevCommit.getName方法的具體用法?Java RevCommit.getName怎麽用?Java RevCommit.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.revwalk.RevCommit的用法示例。


在下文中一共展示了RevCommit.getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getGitFileInfoList

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
/** 저장소의 파일 정보들을 가져와 파일 브라우져를 보여줄 때 사용.
 * @param commitID
 * @param filePath
 * @return
 */
public List<VCSimpleFileInfo> getGitFileInfoList(String commitID,String filePath) {
	List<VCSimpleFileInfo> gitFileInfoList = new ArrayList<VCSimpleFileInfo>();
	List<String> fileList = this.getGitFileList(commitID);
	try{			
		for(String path: WebUtil.getFileList(fileList, "/"+filePath)){
			RevCommit revCommit = CommitUtils.getLastCommit(this.localRepo,
					commitID, path.substring(1));
			String[] strArray = path.substring(1).split("/");
			VCSimpleFileInfo gitFileInfo = new VCSimpleFileInfo(
					strArray[strArray.length-1], path.substring(1),
					isDirectory(commitID,path.substring(1)),
					revCommit.getName(), revCommit.getShortMessage(),
					revCommit.getCommitTime(),
					revCommit.getCommitterIdent().getName(),
					revCommit.getCommitterIdent().getEmailAddress());
			gitFileInfoList.add(gitFileInfo);
		}

	}catch(Exception e){}
	return gitFileInfoList;
}
 
開發者ID:forweaver,項目名稱:forweaver2.0,代碼行數:27,代碼來源:GitUtil.java

示例2: GitTool

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
public GitTool() {
    File gitWorkDir = new File(".");
    try {
        Git git = Git.open(gitWorkDir);
        Iterable<RevCommit> commits = git.log().all().call();
        Repository repo = git.getRepository();
        branch = repo.getBranch();
        RevCommit latestCommit = commits.iterator().next();
        name = latestCommit.getName();
        message = latestCommit.getFullMessage();
    } catch (Throwable e) {
        name = "";
        message = "";
        branch = "";
    }
}
 
開發者ID:yacy,項目名稱:yacy_grid_mcp,代碼行數:17,代碼來源:GitTool.java

示例3: VCSimpleLog

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
public VCSimpleLog(RevCommit revCommit){
	if(revCommit == null)
		return;
	this.logID = revCommit.getName();
	this.shortMassage = revCommit.getShortMessage();
	this.commiterName = revCommit.getAuthorIdent().getName();
	this.commiterEmail =  revCommit.getAuthorIdent().getEmailAddress();
	this.commitDate = new Date(revCommit.getCommitTime()*1000L);
}
 
開發者ID:forweaver,項目名稱:forweaver2.0,代碼行數:10,代碼來源:VCSimpleLog.java

示例4: getRepoMetadata

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
/**
 * Fetch all commit metadata from the repo
 * @param repoDir repository directory
 * @return list of commit metadata
 * @throws IOException
 * @throws GitAPIException
 */
public static List<CommitMetadata> getRepoMetadata(String repoDir) throws IOException, GitAPIException {

  List<CommitMetadata> metadataList = new ArrayList<>();

  FileRepositoryBuilder builder = new FileRepositoryBuilder();
  Repository repository = builder.setGitDir(new File(repoDir, ".git")).readEnvironment().findGitDir().build();

  // Current branch may not be master. Instead of hard coding determine the current branch
  String currentBranch = repository.getBranch();
  Ref head = repository.getRef("refs/heads/" + currentBranch); // current branch may not be "master"
  if (head == null) {
    return metadataList;
  }

  Git git = new Git(repository);

  RevWalk walk = new RevWalk(repository);
  RevCommit commit = walk.parseCommit(head.getObjectId());

  TreeWalk treeWalk = new TreeWalk(repository);
  treeWalk.addTree(commit.getTree());
  treeWalk.setRecursive(true);
  while (treeWalk.next()) {
    String filePath = treeWalk.getPathString();
    Iterable<RevCommit> commitLog = git.log().add(repository.resolve(Constants.HEAD)).addPath(filePath).call();
    for (RevCommit r : commitLog) {
      CommitMetadata metadata = new CommitMetadata(r.getName());
      metadata.setFilePath(filePath);
      metadata.setFileName(FilenameUtils.getName(filePath));
      metadata.setMessage(r.getShortMessage().trim());
      // Difference between committer and author
      // refer to: http://git-scm.com/book/ch2-3.html
      PersonIdent committer = r.getCommitterIdent();
      PersonIdent author = r.getAuthorIdent();
      metadata.setAuthor(author.getName());
      metadata.setAuthorEmail(author.getEmailAddress());
      metadata.setCommitter(committer.getName());
      metadata.setCommitterEmail(committer.getEmailAddress());
      metadata.setCommitTime(committer.getWhen());
      metadataList.add(metadata);
    }
  }
  git.close();
  return metadataList;
}
 
開發者ID:thomas-young-2013,項目名稱:wherehowsX,代碼行數:53,代碼來源:GitUtil.java


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