当前位置: 首页>>代码示例>>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;未经允许,请勿转载。