summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-02-22 08:05:51 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-02-22 08:05:51 +0000
commit11e4c5c1ea1f91d77ed14e08893b44001d0d1459 (patch)
tree342e7b7044f2d4d732df2c9e2474f2ec51553aa1 /lib/redmine/scm
parent1236e037f229e406a681f0207ea3f5534133d6c4 (diff)
downloadredmine-11e4c5c1ea1f91d77ed14e08893b44001d0d1459.tar.gz
redmine-11e4c5c1ea1f91d77ed14e08893b44001d0d1459.zip
scm: Ruby 1.9 compatibility in getting scm version (#4273).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4920 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm')
-rw-r--r--lib/redmine/scm/adapters/bazaar_adapter.rb3
-rw-r--r--lib/redmine/scm/adapters/cvs_adapter.rb3
-rw-r--r--lib/redmine/scm/adapters/darcs_adapter.rb3
-rw-r--r--lib/redmine/scm/adapters/git_adapter.rb3
-rw-r--r--lib/redmine/scm/adapters/mercurial_adapter.rb3
-rw-r--r--lib/redmine/scm/adapters/subversion_adapter.rb3
6 files changed, 18 insertions, 0 deletions
diff --git a/lib/redmine/scm/adapters/bazaar_adapter.rb b/lib/redmine/scm/adapters/bazaar_adapter.rb
index 8bfa2bf25..92a1d693d 100644
--- a/lib/redmine/scm/adapters/bazaar_adapter.rb
+++ b/lib/redmine/scm/adapters/bazaar_adapter.rb
@@ -44,6 +44,9 @@ module Redmine
def scm_command_version
scm_version = scm_version_from_command_line
+ if scm_version.respond_to?(:force_encoding)
+ scm_version.force_encoding('ASCII-8BIT')
+ end
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb
index 6ce10e383..365d44041 100644
--- a/lib/redmine/scm/adapters/cvs_adapter.rb
+++ b/lib/redmine/scm/adapters/cvs_adapter.rb
@@ -44,6 +44,9 @@ module Redmine
def scm_command_version
scm_version = scm_version_from_command_line
+ if scm_version.respond_to?(:force_encoding)
+ scm_version.force_encoding('ASCII-8BIT')
+ end
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
m[2].scan(%r{\d+}).collect(&:to_i)
end
diff --git a/lib/redmine/scm/adapters/darcs_adapter.rb b/lib/redmine/scm/adapters/darcs_adapter.rb
index 0ed7e9637..279d503f0 100644
--- a/lib/redmine/scm/adapters/darcs_adapter.rb
+++ b/lib/redmine/scm/adapters/darcs_adapter.rb
@@ -44,6 +44,9 @@ module Redmine
def darcs_binary_version
darcsversion = darcs_binary_version_from_command_line
+ if darcsversion.respond_to?(:force_encoding)
+ darcsversion.force_encoding('ASCII-8BIT')
+ end
if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb
index 7d742235c..326b7bf64 100644
--- a/lib/redmine/scm/adapters/git_adapter.rb
+++ b/lib/redmine/scm/adapters/git_adapter.rb
@@ -46,6 +46,9 @@ module Redmine
def scm_command_version
scm_version = scm_version_from_command_line
+ if scm_version.respond_to?(:force_encoding)
+ scm_version.force_encoding('ASCII-8BIT')
+ end
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index 5bcb33ea5..e8c5fe883 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -55,6 +55,9 @@ module Redmine
# release number (eg 0.9.5 or 1.0) or as a revision
# id composed of 12 hexa characters.
theversion = hgversion_from_command_line
+ if theversion.respond_to?(:force_encoding)
+ theversion.force_encoding('ASCII-8BIT')
+ end
if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb
index 37d5bcf4d..9f1ccf7ac 100644
--- a/lib/redmine/scm/adapters/subversion_adapter.rb
+++ b/lib/redmine/scm/adapters/subversion_adapter.rb
@@ -45,6 +45,9 @@ module Redmine
def svn_binary_version
scm_version = scm_version_from_command_line
+ if scm_version.respond_to?(:force_encoding)
+ scm_version.force_encoding('ASCII-8BIT')
+ end
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end