scm: Ruby 1.9 compatibility for XML UTF-8 parsing.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4993 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
71aac2e3fe
commit
923558e45c
@ -120,8 +120,12 @@ module Redmine
|
|||||||
def summary
|
def summary
|
||||||
return @summary if @summary
|
return @summary if @summary
|
||||||
hg 'rhsummary' do |io|
|
hg 'rhsummary' do |io|
|
||||||
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
@summary = ActiveSupport::XmlMini.parse(io.read)['rhsummary']
|
@summary = ActiveSupport::XmlMini.parse(output)['rhsummary']
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -132,8 +136,12 @@ module Redmine
|
|||||||
p1 = scm_iconv(@path_encoding, 'UTF-8', path)
|
p1 = scm_iconv(@path_encoding, 'UTF-8', path)
|
||||||
manifest = hg('rhmanifest', '-r', CGI.escape(hgrev(identifier)),
|
manifest = hg('rhmanifest', '-r', CGI.escape(hgrev(identifier)),
|
||||||
CGI.escape(without_leading_slash(p1.to_s))) do |io|
|
CGI.escape(without_leading_slash(p1.to_s))) do |io|
|
||||||
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
ActiveSupport::XmlMini.parse(io.read)['rhmanifest']['repository']['manifest']
|
ActiveSupport::XmlMini.parse(output)['rhmanifest']['repository']['manifest']
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -175,9 +183,13 @@ module Redmine
|
|||||||
hg_args << '--limit' << options[:limit] if options[:limit]
|
hg_args << '--limit' << options[:limit] if options[:limit]
|
||||||
hg_args << hgtarget(path) unless path.blank?
|
hg_args << hgtarget(path) unless path.blank?
|
||||||
log = hg(*hg_args) do |io|
|
log = hg(*hg_args) do |io|
|
||||||
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
# Mercurial < 1.5 does not support footer template for '</log>'
|
# Mercurial < 1.5 does not support footer template for '</log>'
|
||||||
ActiveSupport::XmlMini.parse("#{io.read}</log>")['log']
|
ActiveSupport::XmlMini.parse("#{output}</log>")['log']
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -65,6 +65,9 @@ module Redmine
|
|||||||
info = nil
|
info = nil
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
output = io.read
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
doc = ActiveSupport::XmlMini.parse(output)
|
doc = ActiveSupport::XmlMini.parse(output)
|
||||||
#root_url = doc.elements["info/entry/repository/root"].text
|
#root_url = doc.elements["info/entry/repository/root"].text
|
||||||
@ -94,6 +97,9 @@ module Redmine
|
|||||||
cmd << credentials_string
|
cmd << credentials_string
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
output = io.read
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
doc = ActiveSupport::XmlMini.parse(output)
|
doc = ActiveSupport::XmlMini.parse(output)
|
||||||
each_xml_element(doc['lists']['list'], 'entry') do |entry|
|
each_xml_element(doc['lists']['list'], 'entry') do |entry|
|
||||||
@ -134,6 +140,9 @@ module Redmine
|
|||||||
properties = {}
|
properties = {}
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
output = io.read
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
doc = ActiveSupport::XmlMini.parse(output)
|
doc = ActiveSupport::XmlMini.parse(output)
|
||||||
each_xml_element(doc['properties']['target'], 'property') do |property|
|
each_xml_element(doc['properties']['target'], 'property') do |property|
|
||||||
@ -158,6 +167,9 @@ module Redmine
|
|||||||
cmd << ' ' + target(path)
|
cmd << ' ' + target(path)
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
output = io.read
|
output = io.read
|
||||||
|
if output.respond_to?(:force_encoding)
|
||||||
|
output.force_encoding('UTF-8')
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
doc = ActiveSupport::XmlMini.parse(output)
|
doc = ActiveSupport::XmlMini.parse(output)
|
||||||
each_xml_element(doc['log'], 'logentry') do |logentry|
|
each_xml_element(doc['log'], 'logentry') do |logentry|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user