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


Java RevCommit.getAuthorIdent方法代碼示例

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


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

示例1: respond

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
@Override
protected void respond(AjaxRequestTarget target) {
	IRequestParameters params = RequestCycle.get().getRequest().getPostParameters();
	
	String tooltipId = params.getParameterValue("tooltip").toString();
	String commitHash = params.getParameterValue("commit").toString();
	RevCommit commit = getProject().getRevCommit(commitHash);
	String authoring;
	if (commit.getAuthorIdent() != null) {
		authoring = commit.getAuthorIdent().getName();
		if (commit.getCommitterIdent() != null)
			authoring += " " + DateUtils.formatAge(commit.getCommitterIdent().getWhen());
		authoring = "'" + JavaScriptEscape.escapeJavaScript(authoring) + "'";
	} else {
		authoring = "undefined";
	}
	String message = JavaScriptEscape.escapeJavaScript(commit.getFullMessage());
	String script = String.format("gitplex.server.blameMessage.show('%s', %s, '%s');", tooltipId, authoring, message); 
	target.appendJavaScript(script);
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:21,代碼來源:BlameMessageBehavior.java

示例2: getAuthorName

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
@Override
public String getAuthorName( String commitId ) {
  if ( commitId.equals( IVCS.WORKINGTREE ) ) {
    Config config = git.getRepository().getConfig();
    return config.get( UserConfig.KEY ).getAuthorName()
        + " <" + config.get( UserConfig.KEY ).getAuthorEmail() + ">";
  } else {
    RevCommit commit = resolve( commitId );
    PersonIdent author = commit.getAuthorIdent();
    final StringBuilder r = new StringBuilder();
    r.append( author.getName() );
    r.append( " <" ); //$NON-NLS-1$
    r.append( author.getEmailAddress() );
    r.append( ">" ); //$NON-NLS-1$
    return r.toString();
  }
}
 
開發者ID:HiromuHota,項目名稱:pdi-git-plugin,代碼行數:18,代碼來源:UIGit.java

示例3: transferTimestamp

import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
private void transferTimestamp (org.eclipse.jgit.api.CommitCommand commit, RevCommit lastCommit) {
    PersonIdent lastAuthor = lastCommit.getAuthorIdent();
    if (lastAuthor != null) {
        PersonIdent author = commit.getAuthor();
        commit.setAuthor(lastAuthor.getTimeZone() == null
                ? new PersonIdent(author, lastAuthor.getWhen())
                : new PersonIdent(author, lastAuthor.getWhen(), lastAuthor.getTimeZone()));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:CommitCommand.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.getAuthorIdent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。