@@ -26,15 +26,24 module Redmine | |||||
26 | class AbstractAdapter #:nodoc: |
|
26 | class AbstractAdapter #:nodoc: | |
27 | class << self |
|
27 | class << self | |
28 | # Returns the version of the scm client |
|
28 | # Returns the version of the scm client | |
29 | # Eg: [1, 5, 0] |
|
29 | # Eg: [1, 5, 0] or [] if unknown | |
30 | def client_version |
|
30 | def client_version | |
31 | 'Unknown version' |
|
31 | [] | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | # Returns the version string of the scm client |
|
34 | # Returns the version string of the scm client | |
35 | # Eg: '1.5.0' |
|
35 | # Eg: '1.5.0' or 'Unknown version' if unknown | |
36 | def client_version_string |
|
36 | def client_version_string | |
37 | client_version.is_a?(Array) ? client_version.join('.') : client_version.to_s |
|
37 | v = client_version || 'Unknown version' | |
|
38 | v.is_a?(Array) ? v.join('.') : v.to_s | |||
|
39 | end | |||
|
40 | ||||
|
41 | # Returns true if the current client version is above | |||
|
42 | # or equals the given one | |||
|
43 | # If option is :unknown is set to true, it will return | |||
|
44 | # true if the client version is unknown | |||
|
45 | def client_version_above?(v, options={}) | |||
|
46 | ((client_version <=> v) >= 0) || (client_version.empty? && options[:unknown]) | |||
38 | end |
|
47 | end | |
39 | end |
|
48 | end | |
40 |
|
49 |
@@ -30,7 +30,7 module Redmine | |||||
30 |
|
30 | |||
31 | class << self |
|
31 | class << self | |
32 | def client_version |
|
32 | def client_version | |
33 |
@@client_version ||= (hgversion || |
|
33 | @@client_version ||= (hgversion || []) | |
34 | end |
|
34 | end | |
35 |
|
35 | |||
36 | def hgversion |
|
36 | def hgversion | |
@@ -52,7 +52,7 module Redmine | |||||
52 | end |
|
52 | end | |
53 |
|
53 | |||
54 | def template_path_for(version) |
|
54 | def template_path_for(version) | |
55 |
if |
|
55 | if ((version <=> [0,9,5]) > 0) || version.empty? | |
56 | ver = "1.0" |
|
56 | ver = "1.0" | |
57 | else |
|
57 | else | |
58 | ver = "0.9.5" |
|
58 | ver = "0.9.5" |
@@ -28,7 +28,7 module Redmine | |||||
28 |
|
28 | |||
29 | class << self |
|
29 | class << self | |
30 | def client_version |
|
30 | def client_version | |
31 |
@@client_version ||= (svn_binary_version || |
|
31 | @@client_version ||= (svn_binary_version || []) | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | def svn_binary_version |
|
34 | def svn_binary_version | |
@@ -109,7 +109,7 module Redmine | |||||
109 |
|
109 | |||
110 | def properties(path, identifier=nil) |
|
110 | def properties(path, identifier=nil) | |
111 | # proplist xml output supported in svn 1.5.0 and higher |
|
111 | # proplist xml output supported in svn 1.5.0 and higher | |
112 |
return nil |
|
112 | return nil unless self.class.client_version_above?([1, 5, 0]) | |
113 |
|
113 | |||
114 | identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" |
|
114 | identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" | |
115 | cmd = "#{SVN_BIN} proplist --verbose --xml #{target(path)}@#{identifier}" |
|
115 | cmd = "#{SVN_BIN} proplist --verbose --xml #{target(path)}@#{identifier}" |
@@ -25,7 +25,7 begin | |||||
25 | def test_template_path |
|
25 | def test_template_path | |
26 | to_test = { [0,9,5] => "0.9.5", |
|
26 | to_test = { [0,9,5] => "0.9.5", | |
27 | [1,0] => "1.0", |
|
27 | [1,0] => "1.0", | |
28 |
|
|
28 | [] => "1.0", | |
29 | [1,0,1] => "1.0"} |
|
29 | [1,0,1] => "1.0"} | |
30 |
|
30 | |||
31 | to_test.each do |v, template| |
|
31 | to_test.each do |v, template| |
General Comments 0
You need to be logged in to leave comments.
Login now