scm: git: code clean up adapter.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5544 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-04-24 09:55:26 +00:00
parent f29a4dd6c5
commit fb9fed39fe

View File

@ -144,7 +144,7 @@ module Redmine
def lastrev(path, rev) def lastrev(path, rev)
return nil if path.nil? return nil if path.nil?
cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1| cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1|
cmd_args << rev if rev cmd_args << rev if rev
cmd_args << "--" << path unless path.empty? cmd_args << "--" << path unless path.empty?
lines = [] lines = []
scm_cmd(*cmd_args) { |io| lines = io.readlines } scm_cmd(*cmd_args) { |io| lines = io.readlines }
@ -155,11 +155,11 @@ module Redmine
Revision.new({ Revision.new({
:identifier => id, :identifier => id,
:scmid => id, :scmid => id,
:author => author, :author => author,
:time => time, :time => time,
:message => nil, :message => nil,
:paths => nil :paths => nil
}) })
rescue NoMethodError => e rescue NoMethodError => e
logger.error("The revision '#{path}' has a wrong format") logger.error("The revision '#{path}' has a wrong format")
@ -195,11 +195,11 @@ module Redmine
parsing_descr = 0 parsing_descr = 0
revision = Revision.new({ revision = Revision.new({
:identifier => changeset[:commit], :identifier => changeset[:commit],
:scmid => changeset[:commit], :scmid => changeset[:commit],
:author => changeset[:author], :author => changeset[:author],
:time => Time.parse(changeset[:date]), :time => Time.parse(changeset[:date]),
:message => changeset[:description], :message => changeset[:description],
:paths => files :paths => files
}) })
if block_given? if block_given?
yield revision yield revision
@ -245,11 +245,11 @@ module Redmine
if changeset[:commit] if changeset[:commit]
revision = Revision.new({ revision = Revision.new({
:identifier => changeset[:commit], :identifier => changeset[:commit],
:scmid => changeset[:commit], :scmid => changeset[:commit],
:author => changeset[:author], :author => changeset[:author],
:time => Time.parse(changeset[:date]), :time => Time.parse(changeset[:date]),
:message => changeset[:description], :message => changeset[:description],
:paths => files :paths => files
}) })
if block_given? if block_given?