diff options
Diffstat (limited to 'lib/redmine/scm/adapters/abstract_adapter.rb')
-rw-r--r-- | lib/redmine/scm/adapters/abstract_adapter.rb | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index ec168bf84..0e60de610 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -18,17 +18,13 @@ require 'cgi' require 'redmine/scm/adapters' -if RUBY_VERSION < '1.9' - require 'iconv' -end - module Redmine module Scm module Adapters class AbstractAdapter #:nodoc: # raised if scm command exited with error, e.g. unknown revision. - class ScmCommandAborted < CommandFailed; end + class ScmCommandAborted < ::Redmine::Scm::Adapters::CommandFailed; end class << self def client_command @@ -288,21 +284,12 @@ module Redmine def scm_iconv(to, from, str) return nil if str.nil? return str if to == from - if str.respond_to?(:force_encoding) - str.force_encoding(from) - begin - str.encode(to) - rescue Exception => err - logger.error("failed to convert from #{from} to #{to}. #{err}") - nil - end - else - begin - Iconv.conv(to, from, str) - rescue Iconv::Failure => err - logger.error("failed to convert from #{from} to #{to}. #{err}") - nil - end + str.force_encoding(from) + begin + str.encode(to) + rescue Exception => err + logger.error("failed to convert from #{from} to #{to}. #{err}") + nil end end |