本文整理匯總了Java中org.eclipse.jgit.revwalk.RevCommit.getCommitterIdent方法的典型用法代碼示例。如果您正苦於以下問題:Java RevCommit.getCommitterIdent方法的具體用法?Java RevCommit.getCommitterIdent怎麽用?Java RevCommit.getCommitterIdent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jgit.revwalk.RevCommit
的用法示例。
在下文中一共展示了RevCommit.getCommitterIdent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toCommit
import org.eclipse.jgit.revwalk.RevCommit; //導入方法依賴的package包/類
private static Commit toCommit(RevCommit revCommit) {
final Author author;
final PersonIdent committerIdent = revCommit.getCommitterIdent();
if (committerIdent == null) {
author = Author.UNKNOWN;
} else {
author = new Author(committerIdent.getName(), committerIdent.getEmailAddress());
}
long when = committerIdent.getWhen().getTime();
try {
return CommitUtil.newCommit(author, when, revCommit.getFullMessage());
} catch (Exception e) {
throw new StorageException("failed to create a Commit", e);
}
}
示例2: 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);
}
示例3: 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;
}