Project

General

Profile

Actions

Defect #6346

closed

Age column on repository view is skewed for git, probably CVS too

Added by Felix Schäfer about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
SCM
Target version:
Start date:
2010-09-09
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Ok, this is a nasty one and it wasn't easy to find, but I think I figured it out.

The gist of the problem is that Redmine::Scm::Adapters::Entry#lastrev returns a Redmine::Scm::Adapters::Revision for which the #time is with most adapters a Time expressed in local time, with the git adapter a String and with the CVS adapter a Time, but I'm not sure in what timezone. The problem with this is that the view methods, specifically distance_of_time_in_words (source:/trunk/app/views/repositories/_dir_list_content.rhtml#L21), will happily take either Time or String, but fails to parse the included timezone information, at least in the format the git adapter delivers.

In a console:

>> Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time.class
=> String
>> Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time
=> "Fri Sep 3 17:34:00 2010 +0200" 
>> Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time.to_time
=> Fri Sep 03 17:34:00 UTC 2010
>> Time.parse(Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time).localtime
=> Fri Sep 03 17:34:00 +0200 2010
>> Project.find("sandbox").repository.entry("tags").lastrev.time.class
=> Time
>> Project.find("sandbox").repository.entry("tags").lastrev.time
=> Thu Dec 03 15:41:08 +0100 2009
>> Project.find("sandbox").repository.entry("tags").lastrev.time.to_time
=> Thu Dec 03 15:41:08 +0100 2009

redmine-doodles has a git repo, sandbox a svn repo, #to_time is what distance_of_time_in_words uses to cast whatever it's given to a Time, which misses the time zone information (at least with String#to_time).


Files

6346.patch (1.15 KB) 6346.patch Felix Schäfer, 2010-09-09 21:55
6346-new.diff (1.65 KB) 6346-new.diff Toshi MARUYAMA, 2010-09-17 17:23
git.png (118 KB) git.png Toshi MARUYAMA, 2010-09-20 02:59
Actions

Also available in: Atom PDF