def lastrev(path,rev)
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 << "-- #{path} " unless path.empty?
shellout(cmd) do |io|
id = io.gets.split[1]
author = io.gets.match('Author:\s+(.*)$')[1]
2.times { io.gets }
- time = io.gets.match('CommitDate:\s+(.*)$')[1]
+ time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime
Revision.new({
:identifier => id,
assert_equal "jsmith", annotate.revisions[4].author
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
annotate = @adapter.annotate('renamed_test.txt')
assert_kind_of Redmine::Scm::Adapters::Annotate, annotate