OSDN Git Service

scm: Ruby 1.9 compatibility in getting scm version (#4273).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 22 Feb 2011 08:05:51 +0000 (08:05 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 22 Feb 2011 08:05:51 +0000 (08:05 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4920 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/bazaar_adapter.rb
lib/redmine/scm/adapters/cvs_adapter.rb
lib/redmine/scm/adapters/darcs_adapter.rb
lib/redmine/scm/adapters/git_adapter.rb
lib/redmine/scm/adapters/mercurial_adapter.rb
lib/redmine/scm/adapters/subversion_adapter.rb

index 8bfa2bf..92a1d69 100644 (file)
@@ -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
index 6ce10e3..365d440 100644 (file)
@@ -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
index 0ed7e96..279d503 100644 (file)
@@ -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
index 7d74223..326b7bf 100644 (file)
@@ -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
index 5bcb33e..e8c5fe8 100644 (file)
@@ -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')\r
+            end\r
             if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
               m[2].scan(%r{\d+}).collect(&:to_i)
             end
index 37d5bcf..9f1ccf7 100644 (file)
@@ -45,6 +45,9 @@ module Redmine
 \r
           def svn_binary_version\r
             scm_version = scm_version_from_command_line\r
+            if scm_version.respond_to?(:force_encoding)\r
+              scm_version.force_encoding('ASCII-8BIT')\r
+            end\r
             if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})\r
               m[2].scan(%r{\d+}).collect(&:to_i)\r
             end\r