##// END OF EJS Templates
Fixed: r4417 breaks MercurialAdapter with ruby 1.8.6 (#5117)....
Jean-Philippe Lang -
r4308:cfc3ee4f5a54
parent child
Show More
@@ -38,13 +38,13 module Redmine
38 # release number (eg 0.9.5 or 1.0) or as a revision
38 # release number (eg 0.9.5 or 1.0) or as a revision
39 # id composed of 12 hexa characters.
39 # id composed of 12 hexa characters.
40 theversion = hgversion_from_command_line
40 theversion = hgversion_from_command_line
41 if m = theversion.match(/\b\d+(\.\d+)+\b/)
41 if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
42 m[0].split(".").collect(&:to_i)
42 m[2].scan(%r{\d+}).collect(&:to_i)
43 end
43 end
44 end
44 end
45
45
46 def hgversion_from_command_line
46 def hgversion_from_command_line
47 %x{#{HG_BIN} --version}.lines.first.to_s
47 shellout("#{HG_BIN} --version") { |io| io.read }.to_s
48 end
48 end
49
49
50 def template_path
50 def template_path
@@ -16,8 +16,10 begin
16 "Mercurial Distributed SCM (1e4ddc9ac9f7+20080325)\n" => nil,
16 "Mercurial Distributed SCM (1e4ddc9ac9f7+20080325)\n" => nil,
17 "Mercurial Distributed SCM (1.0.1+20080525)\n" => [1,0,1],
17 "Mercurial Distributed SCM (1.0.1+20080525)\n" => [1,0,1],
18 "Mercurial Distributed SCM (1916e629a29d)\n" => nil,
18 "Mercurial Distributed SCM (1916e629a29d)\n" => nil,
19 "Mercurial SCM Distribuito (versione 0.9.5)\n" => [0,9,5]}
19 "Mercurial SCM Distribuito (versione 0.9.5)\n" => [0,9,5],
20
20 "(1.6)\n(1.7)\n(1.8)" => [1,6],
21 "(1.7.1)\r\n(1.8.1)\r\n(1.9.1)" => [1,7,1]}
22
21 to_test.each do |s, v|
23 to_test.each do |s, v|
22 test_hgversion_for(s, v)
24 test_hgversion_for(s, v)
23 end
25 end
@@ -27,8 +29,9 begin
27 to_test = { [0,9,5] => "0.9.5",
29 to_test = { [0,9,5] => "0.9.5",
28 [1,0] => "1.0",
30 [1,0] => "1.0",
29 [] => "1.0",
31 [] => "1.0",
30 [1,0,1] => "1.0"}
32 [1,0,1] => "1.0",
31
33 [1,7] => "1.0",
34 [1,7,1] => "1.0"}
32 to_test.each do |v, template|
35 to_test.each do |v, template|
33 test_template_path_for(v, template)
36 test_template_path_for(v, template)
34 end
37 end
@@ -50,5 +53,8 begin
50 end
53 end
51
54
52 rescue LoadError
55 rescue LoadError
53 def test_fake; assert(false, "Requires mocha to run those tests") end
56 class MercurialMochaFake < ActiveSupport::TestCase
57 def test_fake; assert(false, "Requires mocha to run those tests") end
58 end
54 end
59 end
60
General Comments 0
You need to be logged in to leave comments. Login now