Index: doc/svn.html
===================================================================
--- doc/svn.html (revision 2692)
+++ doc/svn.html (working copy)
@@ -123,6 +123,11 @@
No (Defaults to "MM/DD/YYYY HH:MM AM_PM") |
+ dateTimeZone |
+ time zone used to format/parse dates (e.g. when revision is specified as date). |
+ No (Defaults to local) |
+
+
failonerror |
Controls whether an error stops the build or is merely reported to the screen. |
No (Defaults to "true") |
Index: src/main/org/tigris/subversion/svnant/commands/SvnCommand.java
===================================================================
--- src/main/org/tigris/subversion/svnant/commands/SvnCommand.java (revision 2692)
+++ src/main/org/tigris/subversion/svnant/commands/SvnCommand.java (working copy)
@@ -57,6 +57,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.TimeZone;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -138,7 +139,7 @@
public SVNRevision getRevisionFrom(String revision)
{
try {
- return SVNRevision.getRevision(revision, new SimpleDateFormat(task.getDateFormatter()));
+ return SVNRevision.getRevision(revision, getDateFormatter());
} catch (ParseException e) {
logWarning("Unable to parse revision string");
return null;
@@ -146,14 +147,24 @@
}
/**
- * Ansewer a give date as string formatted according to current formatter
+ * Answer a give date as string formatted according to current formatter
* @param aDate
* @return a String representation of the date
*/
public String getDateStringFor(Date aDate)
{
- return new SimpleDateFormat(task.getDateFormatter()).format(aDate);
+ return getDateFormatter().format(aDate);
}
+
+ private SimpleDateFormat getDateFormatter()
+ {
+ final SimpleDateFormat formatter = new SimpleDateFormat(task.getDateFormatter());
+ final TimeZone timezone = task.getDateTimeZone();
+ if (timezone != null) {
+ formatter.setTimeZone(timezone);
+ }
+ return formatter;
+ }
public void logVerbose(String message)
{
Index: src/main/org/tigris/subversion/svnant/SvnTask.java
===================================================================
--- src/main/org/tigris/subversion/svnant/SvnTask.java (revision 2692)
+++ src/main/org/tigris/subversion/svnant/SvnTask.java (working copy)
@@ -56,6 +56,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.TimeZone;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -117,6 +118,7 @@
private boolean javahl = true;
private boolean javasvn = true;
private String dateFormatter = null;
+ private TimeZone dateTimeZone = null;
private boolean failonerror = true;
private List commands = new ArrayList();
@@ -174,7 +176,7 @@
}
/**
- * @return dateFormatter used to parse revision dates
+ * @return dateFormatter used to parse/format revision dates
*/
public String getDateFormatter()
{
@@ -182,7 +184,7 @@
}
/**
- * set dateFormatter used to parse revision dates
+ * set dateFormatter used to parse/format revision dates
* @param dateFormatter
*/
public void setDateFormatter(String dateFormatter) {
@@ -190,6 +192,22 @@
}
/**
+ * @return dateTimeZone used to parse/format revision dates
+ */
+ public TimeZone getDateTimeZone()
+ {
+ return dateTimeZone;
+ }
+
+ /**
+ * set dateTimezone used to parse/format revision dates
+ * @param dateTimezone
+ */
+ public void setDateTimezone(String dateTimeZone) {
+ this.dateTimeZone = TimeZone.getTimeZone(dateTimeZone);
+ }
+
+ /**
* @return the failonerror
*/
public boolean isFailonerror() {