comparison lib/redmine/scm/adapters/subversion_adapter.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children 51d7f3e06556 622f24f53b42
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
69 output = io.read 69 output = io.read
70 if output.respond_to?(:force_encoding) 70 if output.respond_to?(:force_encoding)
71 output.force_encoding('UTF-8') 71 output.force_encoding('UTF-8')
72 end 72 end
73 begin 73 begin
74 doc = ActiveSupport::XmlMini.parse(output) 74 doc = parse_xml(output)
75 # root_url = doc.elements["info/entry/repository/root"].text 75 # root_url = doc.elements["info/entry/repository/root"].text
76 info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'], 76 info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'],
77 :lastrev => Revision.new({ 77 :lastrev => Revision.new({
78 :identifier => doc['info']['entry']['commit']['revision'], 78 :identifier => doc['info']['entry']['commit']['revision'],
79 :time => Time.parse(doc['info']['entry']['commit']['date']['__content__']).localtime, 79 :time => Time.parse(doc['info']['entry']['commit']['date']['__content__']).localtime,
101 output = io.read 101 output = io.read
102 if output.respond_to?(:force_encoding) 102 if output.respond_to?(:force_encoding)
103 output.force_encoding('UTF-8') 103 output.force_encoding('UTF-8')
104 end 104 end
105 begin 105 begin
106 doc = ActiveSupport::XmlMini.parse(output) 106 doc = parse_xml(output)
107 each_xml_element(doc['lists']['list'], 'entry') do |entry| 107 each_xml_element(doc['lists']['list'], 'entry') do |entry|
108 commit = entry['commit'] 108 commit = entry['commit']
109 commit_date = commit['date'] 109 commit_date = commit['date']
110 # Skip directory if there is no commit date (usually that 110 # Skip directory if there is no commit date (usually that
111 # means that we don't have read access to it) 111 # means that we don't have read access to it)
144 output = io.read 144 output = io.read
145 if output.respond_to?(:force_encoding) 145 if output.respond_to?(:force_encoding)
146 output.force_encoding('UTF-8') 146 output.force_encoding('UTF-8')
147 end 147 end
148 begin 148 begin
149 doc = ActiveSupport::XmlMini.parse(output) 149 doc = parse_xml(output)
150 each_xml_element(doc['properties']['target'], 'property') do |property| 150 each_xml_element(doc['properties']['target'], 'property') do |property|
151 properties[ property['name'] ] = property['__content__'].to_s 151 properties[ property['name'] ] = property['__content__'].to_s
152 end 152 end
153 rescue 153 rescue
154 end 154 end
171 output = io.read 171 output = io.read
172 if output.respond_to?(:force_encoding) 172 if output.respond_to?(:force_encoding)
173 output.force_encoding('UTF-8') 173 output.force_encoding('UTF-8')
174 end 174 end
175 begin 175 begin
176 doc = ActiveSupport::XmlMini.parse(output) 176 doc = parse_xml(output)
177 each_xml_element(doc['log'], 'logentry') do |logentry| 177 each_xml_element(doc['log'], 'logentry') do |logentry|
178 paths = [] 178 paths = []
179 each_xml_element(logentry['paths'], 'path') do |path| 179 each_xml_element(logentry['paths'], 'path') do |path|
180 paths << {:action => path['action'], 180 paths << {:action => path['action'],
181 :path => path['__content__'], 181 :path => path['__content__'],
197 end 197 end
198 return nil if $? && $?.exitstatus != 0 198 return nil if $? && $?.exitstatus != 0
199 revisions 199 revisions
200 end 200 end
201 201
202 def diff(path, identifier_from, identifier_to=nil, type="inline") 202 def diff(path, identifier_from, identifier_to=nil)
203 path ||= '' 203 path ||= ''
204 identifier_from = (identifier_from and identifier_from.to_i > 0) ? identifier_from.to_i : '' 204 identifier_from = (identifier_from and identifier_from.to_i > 0) ? identifier_from.to_i : ''
205 205
206 identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : (identifier_from.to_i - 1) 206 identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : (identifier_from.to_i - 1)
207 207