Mercurial > hg > soundsoftware-site
diff lib/redmine/scm/adapters/git_adapter.rb @ 119:8661b858af72
* Update to Redmine trunk rev 4705
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:12:06 +0000 |
parents | 94944d00e43c |
children | 0579821a129a |
line wrap: on
line diff
--- a/lib/redmine/scm/adapters/git_adapter.rb Fri Nov 19 14:05:24 2010 +0000 +++ b/lib/redmine/scm/adapters/git_adapter.rb Thu Jan 13 14:12:06 2011 +0000 @@ -89,12 +89,13 @@ cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --date=iso --pretty=fuller --no-merges -n 1 " cmd << " #{shell_quote rev} " if rev cmd << "-- #{shell_quote path} " unless path.empty? - shellout(cmd) do |io| - begin - id = io.gets.split[1] - author = io.gets.match('Author:\s+(.*)$')[1] - 2.times { io.gets } - time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime + lines = [] + shellout(cmd) { |io| lines = io.readlines } + return nil if $? && $?.exitstatus != 0 + begin + id = lines[0].split[1] + author = lines[1].match('Author:\s+(.*)$')[1] + time = Time.parse(lines[4].match('CommitDate:\s+(.*)$')[1]).localtime Revision.new({ :identifier => id, @@ -104,10 +105,9 @@ :message => nil, :paths => nil }) - rescue NoMethodError => e + rescue NoMethodError => e logger.error("The revision '#{path}' has a wrong format") return nil - end end end @@ -117,7 +117,7 @@ cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --raw --date=iso --pretty=fuller " cmd << " --reverse " if options[:reverse] cmd << " --all " if options[:all] - cmd << " -n #{options[:limit]} " if options[:limit] + cmd << " -n #{options[:limit].to_i} " if options[:limit] cmd << "#{shell_quote(identifier_from + '..')}" if identifier_from cmd << "#{shell_quote identifier_to}" if identifier_to cmd << " --since=#{shell_quote(options[:since].strftime("%Y-%m-%d %H:%M:%S"))}" if options[:since] @@ -264,6 +264,13 @@ return nil if $? && $?.exitstatus != 0 cat end + + class Revision < Redmine::Scm::Adapters::Revision + # Returns the readable identifier + def format_identifier + identifier[0,8] + end + end end end end