Parse the timezone in #last_rev for git to correct display the Age diplay. #6346
Contributed by Felix Schäfer git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4187 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
83e0be5d07
commit
319849caf8
@ -86,7 +86,7 @@ module Redmine
|
|||||||
|
|
||||||
def lastrev(path,rev)
|
def lastrev(path,rev)
|
||||||
return nil if path.nil?
|
return nil if path.nil?
|
||||||
cmd = "#{GIT_BIN} --git-dir #{target('')} log --pretty=fuller --no-merges -n 1 "
|
cmd = "#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller --no-merges -n 1 "
|
||||||
cmd << " #{shell_quote rev} " if rev
|
cmd << " #{shell_quote rev} " if rev
|
||||||
cmd << "-- #{path} " unless path.empty?
|
cmd << "-- #{path} " unless path.empty?
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
@ -94,7 +94,7 @@ module Redmine
|
|||||||
id = io.gets.split[1]
|
id = io.gets.split[1]
|
||||||
author = io.gets.match('Author:\s+(.*)$')[1]
|
author = io.gets.match('Author:\s+(.*)$')[1]
|
||||||
2.times { io.gets }
|
2.times { io.gets }
|
||||||
time = io.gets.match('CommitDate:\s+(.*)$')[1]
|
time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime
|
||||||
|
|
||||||
Revision.new({
|
Revision.new({
|
||||||
:identifier => id,
|
:identifier => id,
|
||||||
|
@ -29,6 +29,14 @@ class GitAdapterTest < ActiveSupport::TestCase
|
|||||||
assert_equal "jsmith", annotate.revisions[4].author
|
assert_equal "jsmith", annotate.revisions[4].author
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_last_rev
|
||||||
|
last_rev = @adapter.lastrev("README", "4f26664364207fa8b1af9f8722647ab2d4ac5d43")
|
||||||
|
assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.scmid
|
||||||
|
assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.identifier
|
||||||
|
assert_equal "Adam Soltys <asoltys@gmail.com>", last_rev.author
|
||||||
|
assert_equal "2009-06-24 05:27:38".to_time, last_rev.time
|
||||||
|
end
|
||||||
|
|
||||||
def test_annotate_moved_file
|
def test_annotate_moved_file
|
||||||
annotate = @adapter.annotate('renamed_test.txt')
|
annotate = @adapter.annotate('renamed_test.txt')
|
||||||
assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
|
assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user