Patch #26149 » 0001-removes-duplicate-shell_quote-method.patch
lib/redmine/scm/adapters/abstract_adapter.rb | ||
---|---|---|
22 | 22 |
module Scm |
23 | 23 |
module Adapters |
24 | 24 |
class AbstractAdapter #:nodoc: |
25 |
include Redmine::Utils::Shell |
|
25 | 26 | |
26 | 27 |
# raised if scm command exited with error, e.g. unknown revision. |
27 | 28 |
class ScmCommandAborted < ::Redmine::Scm::Adapters::CommandFailed; end |
28 | 29 | |
29 | 30 |
class << self |
31 | ||
30 | 32 |
def client_command |
31 | 33 |
"" |
32 | 34 |
end |
33 | 35 | |
36 |
def shell_quote(str) |
|
37 |
Redmine::Utils::Shell.shell_quote str |
|
38 |
end |
|
39 | ||
34 | 40 |
def shell_quote_command |
35 |
if Redmine::Platform.mswin? && RUBY_PLATFORM == 'java' |
|
36 |
client_command |
|
37 |
else |
|
38 |
shell_quote(client_command) |
|
39 |
end |
|
41 |
Redmine::Utils::Shell.shell_quote_command client_command |
|
40 | 42 |
end |
41 | 43 | |
42 | 44 |
# Returns the version of the scm client |
... | ... | |
64 | 66 |
true |
65 | 67 |
end |
66 | 68 | |
67 |
def shell_quote(str) |
|
68 |
if Redmine::Platform.mswin? |
|
69 |
'"' + str.gsub(/"/, '\\"') + '"' |
|
70 |
else |
|
71 |
"'" + str.gsub(/'/, "'\"'\"'") + "'" |
|
72 |
end |
|
73 |
end |
|
74 | 69 |
end |
75 | 70 | |
76 | 71 |
def initialize(url, root_url=nil, login=nil, password=nil, |
... | ... | |
180 | 175 |
(path[-1,1] == "/") ? path[0..-2] : path |
181 | 176 |
end |
182 | 177 | |
183 |
def shell_quote(str) |
|
184 |
self.class.shell_quote(str) |
|
185 |
end |
|
186 | ||
187 | 178 |
private |
188 | 179 |
def retrieve_root_url |
189 | 180 |
info = self.info |
lib/redmine/utils.rb | ||
---|---|---|
64 | 64 |
end |
65 | 65 | |
66 | 66 |
module Shell |
67 | ||
68 |
module_function |
|
69 | ||
67 | 70 |
def shell_quote(str) |
68 | 71 |
if Redmine::Platform.mswin? |
69 | 72 |
'"' + str.gsub(/"/, '\\"') + '"' |
... | ... | |
71 | 74 |
"'" + str.gsub(/'/, "'\"'\"'") + "'" |
72 | 75 |
end |
73 | 76 |
end |
77 | ||
78 |
def shell_quote_command(command) |
|
79 |
if Redmine::Platform.mswin? && RUBY_PLATFORM == 'java' |
|
80 |
command |
|
81 |
else |
|
82 |
shell_quote(command) |
|
83 |
end |
|
84 |
end |
|
74 | 85 |
end |
75 | 86 | |
76 | 87 |
module DateCalculation |