Example usage for org.eclipse.jgit.util GitDateFormatter formatDate

List of usage examples for org.eclipse.jgit.util GitDateFormatter formatDate

Introduction

In this page you can find the example usage for org.eclipse.jgit.util GitDateFormatter formatDate.

Prototype

@SuppressWarnings("boxing")
public String formatDate(PersonIdent ident) 

Source Link

Document

Format committer, author or tagger ident according to this formatter's specification.

Usage

From source file:com.google.gerrit.server.notedb.CommentsInNotesUtil.java

License:Apache License

public static String formatTime(PersonIdent ident, Timestamp t) {
    GitDateFormatter dateFormatter = new GitDateFormatter(Format.DEFAULT);
    // TODO(dborowitz): Use a ThreadLocal or use Joda.
    PersonIdent newIdent = new PersonIdent(ident, t);
    return dateFormatter.formatDate(newIdent);
}

From source file:com.google.gitiles.CommitSoyData.java

License:Open Source License

static Map<String, String> toSoyData(PersonIdent ident, GitDateFormatter dateFormatter) {
    return ImmutableMap.of("name", ident.getName(), "email", ident.getEmailAddress(), "time",
            dateFormatter.formatDate(ident),
            // TODO(dborowitz): Switch from relative to absolute at some threshold.
            "relativeTime", RelativeDateFormatter.format(ident.getWhen()));
}