List of usage examples for org.eclipse.jgit.util GitDateFormatter GitDateFormatter
public GitDateFormatter(Format format)
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.BlameServlet.java
License:Open Source License
@Override protected void doGetHtml(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); RevWalk rw = new RevWalk(repo); try {/* ww w .j ava 2 s. c om*/ RevCommit commit = rw.parseCommit(view.getRevision().getId()); ObjectId blobId = resolveBlob(view, rw, commit); if (blobId == null) { res.setStatus(SC_NOT_FOUND); return; } String title = "Blame - " + view.getPathPart(); Map<String, ?> blobData = new BlobSoyData(rw, view).toSoyData(view.getPathPart(), blobId); if (blobData.get("data") != null) { List<Region> regions = cache.get(repo, commit, view.getPathPart()); if (regions.isEmpty()) { res.setStatus(SC_NOT_FOUND); return; } GitDateFormatter df = new GitDateFormatter(Format.DEFAULT); renderHtml(req, res, "gitiles.blameDetail", ImmutableMap.of("title", title, "breadcrumbs", view.getBreadcrumbs(), "data", blobData, "regions", toSoyData(view, rw.getObjectReader(), regions, df))); } else { renderHtml(req, res, "gitiles.blameDetail", ImmutableMap.of("title", title, "breadcrumbs", view.getBreadcrumbs(), "data", blobData)); } } finally { rw.release(); } }
From source file:com.google.gitiles.CommitSoyData.java
License:Open Source License
public CommitSoyData(@Nullable Linkifier linkifier, HttpServletRequest req, Repository repo, RevWalk walk, GitilesView view, @Nullable Map<AnyObjectId, Set<Ref>> refsById) { this.linkifier = linkifier; this.req = req; this.repo = repo; this.walk = walk; this.view = view; this.refsById = refsById; this.dateFormatter = new GitDateFormatter(Format.DEFAULT); }
From source file:com.google.gitiles.TagSoyData.java
License:Open Source License
public TagSoyData(Linkifier linkifier, HttpServletRequest req) { this.linkifier = linkifier; this.req = req; this.dateFormatter = new GitDateFormatter(Format.DEFAULT); }
From source file:org.eclipse.egit.ui.internal.dialogs.CommitLabelProvider.java
License:Open Source License
private GitDateFormatter getDateFormatter() { if (dateFormatter == null) dateFormatter = new GitDateFormatter(format); return dateFormatter; }
From source file:org.eclipse.egit.ui.internal.preferences.DateFormatPreferencePage.java
License:Open Source License
private void updatePreview(GitDateFormatter.Format format) { dateFormatPreview.setText(new GitDateFormatter(format).formatDate(SAMPLE)); }
From source file:org.eclipse.egit.ui.internal.rebase.RebaseInteractiveView.java
License:Open Source License
private static GitDateFormatter getNewDateFormatter() { boolean useRelativeDates = Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_RELATIVE_DATE); if (useRelativeDates) return new GitDateFormatter(Format.RELATIVE); else/*from w w w. ja va 2s .c om*/ return PreferenceBasedDateFormatter.create(); }