@@ -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 theversion.match(/ |
|
41 | if m = theversion.match(/\b\d+(\.\d+)+\b/) | |
42 |
|
|
42 | m[0].split(".").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}. |
|
47 | %x{#{HG_BIN} --version}.lines.first.to_s | |
48 | end |
|
48 | end | |
49 |
|
49 | |||
50 | def template_path |
|
50 | def template_path |
@@ -11,11 +11,12 begin | |||||
11 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository' |
|
11 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository' | |
12 |
|
12 | |||
13 | def test_hgversion |
|
13 | def test_hgversion | |
14 | to_test = { "0.9.5" => [0,9,5], |
|
14 | to_test = { "Mercurial Distributed SCM (version 0.9.5)\n" => [0,9,5], | |
15 | "1.0" => [1,0], |
|
15 | "Mercurial Distributed SCM (1.0)\n" => [1,0], | |
16 | "1e4ddc9ac9f7+20080325" => nil, |
|
16 | "Mercurial Distributed SCM (1e4ddc9ac9f7+20080325)\n" => nil, | |
17 | "1.0.1+20080525" => [1,0,1], |
|
17 | "Mercurial Distributed SCM (1.0.1+20080525)\n" => [1,0,1], | |
18 |
"1916e629a29d" => nil |
|
18 | "Mercurial Distributed SCM (1916e629a29d)\n" => nil, | |
|
19 | "Mercurial SCM Distribuito (versione 0.9.5)\n" => [0,9,5]} | |||
19 |
|
20 | |||
20 | to_test.each do |s, v| |
|
21 | to_test.each do |s, v| | |
21 | test_hgversion_for(s, v) |
|
22 | test_hgversion_for(s, v) |
General Comments 0
You need to be logged in to leave comments.
Login now