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
This commit is contained in:
Toshi MARUYAMA 2011-02-22 08:05:51 +00:00
parent 1236e037f2
commit 11e4c5c1ea
6 changed files with 18 additions and 0 deletions

View 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

View 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

View 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

View 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

View 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')
end
if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end

View File

@ -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