Project

General

Profile

Feature #1406 » git_adapter.rb.diff

Fix Git commands who list branches and tags to be more Windows friendly and checking if last revision is correctly formatted - Babar O'Cap, 2009-08-11 10:20

View differences:

C:\Repos\redmine\lib\redmine\scm\adapters\git_adapter.rb b\lib\redmine\scm\adapters\git_adapter.rb
def branches
branches = []
cmd = "cd #{target('')} && #{GIT_BIN} branch"
cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
shellout(cmd) do |io|
io.each_line do |line|
branches << line.match('\s*\*?\s*(.*)$')[1]
......
def tags
tags = []
cmd = "cd #{target('')} && #{GIT_BIN} tag"
cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
shellout(cmd) do |io|
io.readlines.sort!.map{|t| t.strip}
end
......
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]
begin
id = io.gets.split[1]
author = io.gets.match('Author:\s+(.*)$')[1]
2.times { io.gets }
time = io.gets.match('CommitDate:\s+(.*)$')[1]
Revision.new({
:identifier => id,
:scmid => id,
:author => author,
:time => time,
:message => nil,
:paths => nil
})
Revision.new({
:identifier => id,
:scmid => id,
:author => author,
:time => time,
:message => nil,
:paths => nil
})
rescue NoMethodError => e
logger.error("The revision '#{path}' has a wrong format")
return nil
end
end
end
def num_revisions
cmd = "#{GIT_BIN} --git-dir #{target('')} log --all --pretty=format:'' | wc -l"
shellout(cmd) {|io| io.gets.chomp.to_i + 1 }
shellout(cmd) {|io| io.gets.chomp.to_i + 1}
end
def revisions(path, identifier_from, identifier_to, options={})
......
if changeset[:commit]
revision = Revision.new({:identifier => changeset[:commit],
:scmid => changeset[:commit],
:author => changeset[:author],
:time => Time.parse(changeset[:date]),
:message => changeset[:description],
:paths => files
})
:scmid => changeset[:commit],
:author => changeset[:author],
:time => Time.parse(changeset[:date]),
:message => changeset[:description],
:paths => files
})
if block_given?
yield revision
else
(4-4/5)