@@ -86,7 +86,7 module Redmine | |||||
86 |
|
86 | |||
87 | def lastrev(path,rev) |
|
87 | def lastrev(path,rev) | |
88 | return nil if path.nil? |
|
88 | return nil if path.nil? | |
89 | cmd = "#{GIT_BIN} --git-dir #{target('')} log --pretty=fuller --no-merges -n 1 " |
|
89 | cmd = "#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller --no-merges -n 1 " | |
90 | cmd << " #{shell_quote rev} " if rev |
|
90 | cmd << " #{shell_quote rev} " if rev | |
91 | cmd << "-- #{path} " unless path.empty? |
|
91 | cmd << "-- #{path} " unless path.empty? | |
92 | shellout(cmd) do |io| |
|
92 | shellout(cmd) do |io| | |
@@ -94,7 +94,7 module Redmine | |||||
94 | id = io.gets.split[1] |
|
94 | id = io.gets.split[1] | |
95 | author = io.gets.match('Author:\s+(.*)$')[1] |
|
95 | author = io.gets.match('Author:\s+(.*)$')[1] | |
96 | 2.times { io.gets } |
|
96 | 2.times { io.gets } | |
97 | time = io.gets.match('CommitDate:\s+(.*)$')[1] |
|
97 | time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime | |
98 |
|
98 | |||
99 | Revision.new({ |
|
99 | Revision.new({ | |
100 | :identifier => id, |
|
100 | :identifier => id, |
@@ -29,6 +29,14 class GitAdapterTest < ActiveSupport::TestCase | |||||
29 | assert_equal "jsmith", annotate.revisions[4].author |
|
29 | assert_equal "jsmith", annotate.revisions[4].author | |
30 | end |
|
30 | end | |
31 |
|
31 | |||
|
32 | def test_last_rev | |||
|
33 | last_rev = @adapter.lastrev("README", "4f26664364207fa8b1af9f8722647ab2d4ac5d43") | |||
|
34 | assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.scmid | |||
|
35 | assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.identifier | |||
|
36 | assert_equal "Adam Soltys <asoltys@gmail.com>", last_rev.author | |||
|
37 | assert_equal "2009-06-24 05:27:38".to_time, last_rev.time | |||
|
38 | end | |||
|
39 | ||||
32 | def test_annotate_moved_file |
|
40 | def test_annotate_moved_file | |
33 | annotate = @adapter.annotate('renamed_test.txt') |
|
41 | annotate = @adapter.annotate('renamed_test.txt') | |
34 | assert_kind_of Redmine::Scm::Adapters::Annotate, annotate |
|
42 | assert_kind_of Redmine::Scm::Adapters::Annotate, annotate |
General Comments 0
You need to be logged in to leave comments.
Login now