summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-10-28 04:58:26 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-10-28 04:58:26 +0000
commit36f51878a3706d8ea341b8fd58be839111b15ee2 (patch)
tree6eb9ca8a6295a39a4d6a52f833b48abc1aaac351 /lib/redmine/scm
parent613a056ed653de35235ff542f15929c7228fbcb9 (diff)
downloadredmine-36f51878a3706d8ea341b8fd58be839111b15ee2.tar.gz
redmine-36f51878a3706d8ea341b8fd58be839111b15ee2.zip
scm: git: lib: add parents to Revision class (#5501)
Contributed by Jan TopiƄski. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7668 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm')
-rw-r--r--lib/redmine/scm/adapters/git_adapter.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb
index 6fe31cb71..f5dfbe2ae 100644
--- a/lib/redmine/scm/adapters/git_adapter.rb
+++ b/lib/redmine/scm/adapters/git_adapter.rb
@@ -185,7 +185,7 @@ module Redmine
def revisions(path, identifier_from, identifier_to, options={})
revs = Revisions.new
- cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller|
+ cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents|
cmd_args << "--reverse" if options[:reverse]
cmd_args << "--all" if options[:all]
cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
@@ -202,9 +202,10 @@ module Redmine
parsing_descr = 0 #0: not parsing desc or files, 1: parsing desc, 2: parsing files
io.each_line do |line|
- if line =~ /^commit ([0-9a-f]{40})$/
+ if line =~ /^commit ([0-9a-f]{40})(( [0-9a-f]{40})*)$/
key = "commit"
value = $1
+ parents_str = $2
if (parsing_descr == 1 || parsing_descr == 2)
parsing_descr = 0
revision = Revision.new({
@@ -213,7 +214,8 @@ module Redmine
:author => changeset[:author],
:time => Time.parse(changeset[:date]),
:message => changeset[:description],
- :paths => files
+ :paths => files,
+ :parents => changeset[:parents]
})
if block_given?
yield revision
@@ -224,6 +226,9 @@ module Redmine
files = []
end
changeset[:commit] = $1
+ unless parents_str.nil? or parents_str == ""
+ changeset[:parents] = parents_str.strip.split(' ')
+ end
elsif (parsing_descr == 0) && line =~ /^(\w+):\s*(.*)$/
key = $1
value = $2
@@ -263,7 +268,8 @@ module Redmine
:author => changeset[:author],
:time => Time.parse(changeset[:date]),
:message => changeset[:description],
- :paths => files
+ :paths => files,
+ :parents => changeset[:parents]
})
if block_given?
yield revision