2 * Copyright (C) 2008 Shawn Pearce <spearce@spearce.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License, version 2, as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17 package org
.spearce
.jgit
.pgm
;
19 import java
.text
.DateFormat
;
20 import java
.text
.SimpleDateFormat
;
21 import java
.util
.TimeZone
;
23 import org
.spearce
.jgit
.lib
.PersonIdent
;
24 import org
.spearce
.jgit
.revwalk
.RevCommit
;
26 class Log
extends RevWalkTextBuiltin
{
27 private final TimeZone myTZ
= TimeZone
.getDefault();
29 private final DateFormat fmt
;
32 fmt
= new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy ZZZZZ");
36 protected void show(final RevCommit c
) throws Exception
{
38 c
.getId().copyTo(outbuffer
, out
);
41 final PersonIdent author
= c
.getAuthorIdent();
42 out
.print("Author: ");
43 out
.print(author
.getName());
45 out
.print(author
.getEmailAddress());
49 final TimeZone authorTZ
= author
.getTimeZone();
50 fmt
.setTimeZone(authorTZ
!= null ? authorTZ
: myTZ
);
52 out
.print(fmt
.format(author
.getWhen()));
56 final String
[] lines
= c
.getFullMessage().split("\n");
57 for (final String s
: lines
) {