diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-03-03 05:51:46 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-03-03 05:51:46 +0000 |
commit | 923558e45c11184d50be70ca12702dd7a54662ea (patch) | |
tree | 2ebdee0dec2c8ac07ec137311b119fed7c778c52 /lib/redmine/scm/adapters/mercurial_adapter.rb | |
parent | 71aac2e3fe47ceeafa1c6a50aa8025093af4d33f (diff) | |
download | redmine-923558e45c11184d50be70ca12702dd7a54662ea.tar.gz redmine-923558e45c11184d50be70ca12702dd7a54662ea.zip |
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
Diffstat (limited to 'lib/redmine/scm/adapters/mercurial_adapter.rb')
-rw-r--r-- | lib/redmine/scm/adapters/mercurial_adapter.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index a0f1db195..1f9153fab 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -120,8 +120,12 @@ module Redmine def summary return @summary if @summary hg 'rhsummary' do |io| + output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin - @summary = ActiveSupport::XmlMini.parse(io.read)['rhsummary'] + @summary = ActiveSupport::XmlMini.parse(output)['rhsummary'] rescue end end @@ -132,8 +136,12 @@ module Redmine p1 = scm_iconv(@path_encoding, 'UTF-8', path) manifest = hg('rhmanifest', '-r', CGI.escape(hgrev(identifier)), 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 - ActiveSupport::XmlMini.parse(io.read)['rhmanifest']['repository']['manifest'] + ActiveSupport::XmlMini.parse(output)['rhmanifest']['repository']['manifest'] rescue end end @@ -175,9 +183,13 @@ module Redmine hg_args << '--limit' << options[:limit] if options[:limit] hg_args << hgtarget(path) unless path.blank? log = hg(*hg_args) do |io| + output = io.read + if output.respond_to?(:force_encoding) + output.force_encoding('UTF-8') + end begin # Mercurial < 1.5 does not support footer template for '</log>' - ActiveSupport::XmlMini.parse("#{io.read}</log>")['log'] + ActiveSupport::XmlMini.parse("#{output}</log>")['log'] rescue end end |