From 732ee35b2fdb36921d02cbbefdae115a88d84485 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 11 Mar 2011 04:19:33 +0000 Subject: [PATCH] scm: cvs: fix age column on repository view is off by timezone delta (#7827). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5088 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/cvs_adapter.rb | 12 +++++++++++- .../lib/redmine/scm/adapters/cvs_adapter_test.rb | 8 ++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb index 194b6e84c..9827b8969 100644 --- a/lib/redmine/scm/adapters/cvs_adapter.rb +++ b/lib/redmine/scm/adapters/cvs_adapter.rb @@ -107,6 +107,16 @@ module Redmine fields = line.chop.split('/',-1) logger.debug(">>InspectLine #{fields.inspect}") if fields[0]!="D" + time = nil + # Thu Dec 13 16:27:22 2007 + time_l = fields[-3].split(' ') + if time_l.size == 5 && time_l[4].length == 4 + begin + time = Time.parse( + "#{time_l[1]} #{time_l[2]} #{time_l[3]} GMT #{time_l[4]}") + rescue + end + end entries << Entry.new( { :name => fields[-5], @@ -118,7 +128,7 @@ module Redmine { :revision => fields[-4], :name => fields[-4], - :time => Time.parse(fields[-3]), + :time => time, :author => '' }) }) diff --git a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb index b6155ea34..197d7df12 100644 --- a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb @@ -39,6 +39,14 @@ begin assert_equal 2, cnt end + def test_entries_rev3 + rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22) + entries = @adapter.entries('sources', rev3_committed_on) + assert_equal 2, entries.size + assert_equal entries[0].name, "watchers_controller.rb" + assert_equal entries[0].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22) + end + private def test_scm_version_for(scm_command_version, version)