List of usage examples for org.eclipse.jgit.lib PersonIdent toExternalString
public String toExternalString()
From source file:com.google.gerrit.server.account.GroupUUID.java
License:Apache License
public static AccountGroup.UUID make(String groupName, PersonIdent creator) { MessageDigest md = Constants.newMessageDigest(); md.update(Constants.encode("group " + groupName + "\n")); md.update(Constants.encode("creator " + creator.toExternalString() + "\n")); return new AccountGroup.UUID(ObjectId.fromRaw(md.digest()).name()); }
From source file:m.k.s.gitwrapper.GitLocalService.java
License:Apache License
private void getInfo(RevCommit revCommit) { String commitName;/*from ww w. ja v a2 s .com*/ Date commitDate; String filePath; String authorEmail; String authorName; String message; Gson gson = new Gson(); // LOG.debug("author=" + gson.toJson(author)); LOG.debug("---Log Commit---"); PersonIdent author = revCommit.getAuthorIdent(); commitName = revCommit.getName(); LOG.debug("revCommit.getName() = " + commitName); commitDate = author.getWhen(); authorEmail = author.getEmailAddress(); authorName = author.getName(); LOG.debug("author.getWhen()=" + author.getWhen()); LOG.debug("author.toExternalString()=" + author.toExternalString()); LOG.debug("authorName=" + authorName); LOG.debug("author.getTimeZone()=" + author.getTimeZone()); LOG.debug("revCommit.getParentCount()=" + revCommit.getParentCount()); LOG.debug("revCommit.getShortMessage() = " + revCommit.getShortMessage()); message = revCommit.getFullMessage(); LOG.debug("message = " + message); LOG.debug("-------------------"); DiffFormatter df = new DiffFormatter(DisabledOutputStream.INSTANCE); df.setRepository(repository); df.setDiffComparator(RawTextComparator.DEFAULT); df.setDetectRenames(true); if (revCommit.getParentCount() > 0) { for (RevCommit parentCommit : revCommit.getParents()) { try { List<DiffEntry> diffs = df.scan(parentCommit.getTree(), revCommit.getTree()); for (DiffEntry diff : diffs) { LOG.debug(MessageFormat.format("({0} {1} {2}", diff.getChangeType().name(), diff.getNewMode().getBits(), diff.getNewPath())); filePath = diff.getNewPath(); outputter.write(commitName, commitDate, authorName, authorEmail, filePath, message); } } catch (IOException ex) { LOG.error("Could not get comitted files of commit '" + commitName + "'", ex); } } } else { TreeWalk treeWalk = new TreeWalk(repository); RevTree tree = revCommit.getTree(); try { treeWalk.addTree(tree); treeWalk.setRecursive(true); treeWalk.setFilter(TreeFilter.ANY_DIFF); while (treeWalk.next()) { LOG.debug("treeWalk.getPathString()=" + treeWalk.getPathString()); filePath = treeWalk.getPathString(); outputter.write(commitName, commitDate, authorName, authorEmail, filePath, message); } } catch (Exception ex) { LOG.error("Could not get comitted files of commit '" + commitName + "'", ex); } finally { treeWalk.close(); } } }