]> source.dussan.org Git - redmine.git/commitdiff
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 8bfa2bf25ca950bde5231f22ca1b13dcb706df47..92a1d693dbbecbdd235243cea783e8bfcf7d90e3 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 6ce10e38384c4186e6345bea4354290e1d3eeafa..365d440414d4217544d44ec7d19aed6f6c69416d 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 0ed7e963700101412bec5406f73f34da3dab50bc..279d503f06c8dc33e69c1a88512e521183c79e6b 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 7d742235c7123475f80abbbb9f530707a488ff81..326b7bf6442aa17195015612a59ee3ac16d926b3 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 5bcb33ea54b829385feb1e2a325a1860c76f9074..e8c5fe88359e673459e9c307d97e71f68b9df347 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 37d5bcf4dd2762bb0123dfc2ffd96ab32f457e50..9f1ccf7ace2e54bf2c70051d173a3113382de8b5 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