Subject: | Error parsing time for CVS |
Hi,
I am seeing the same error with the CVS tests reported here:
http://www.cpantesters.org/cpan/report/e1dbb20e-b5f9-11df-bcaa-907a06264d1f
Apparently some versions of CVS output a timezone with the commit time. For example:
revision 1.1
date: 2003-02-05 19:39:23 -0500; author: dwc; state: Exp;
Initial checkin
This is on:
$ cvs --version
Concurrent Versions System (CVS) 1.12.12 (client)
Attached is a possible fix, forcing the timezone to UTC before running `cvs log` and adding an
optional part to the regular expression to make it work on the different output.
Subject: | vci-cvs-timezone.patch |
=== modified file 'lib/VCI/VCS/Cvs/File.pm'
--- lib/VCI/VCS/Cvs/File.pm 2010-08-21 20:02:18 +0000
+++ lib/VCI/VCS/Cvs/File.pm 2010-09-17 14:52:58 +0000
@@ -20,14 +20,18 @@
sub _build_time {
my $self = shift;
my $rev = $self->revision;
+
+ # Force timezone to UTC in order to get consistent commit times
+ local $ENV{TZ} = 'UTC';
my $output = $self->vci->x_do(
args => ['-n', 'log', '-N', "-r$rev", $self->name],
fromdir => $self->parent->x_cvs_dir);
- $output =~ /^date: (\S+ \S+);/ms;
+ $output =~ /^date: (\S+ \S+)( \S+)?;/ms;
my $time = $1;
+ my $tz = $2 || 'UTC';
confess("Failed to parse time for " . $self->path->stringify . " $rev")
if !defined $time;
- return "$time UTC";
+ return "$time $tz";
}
sub _build_content {