mirror of
https://github.com/redmine/redmine.git
synced 2025-11-04 20:35:57 +01:00
"C:\Program Files\TortoiseHg\hg.exe" can be used in config/configuration.yml. In Ruby 1.9 IO.popen, if cmd is an Array of String, it will be used as the subprocess‘s argv bypassing a shell. See http://www.ruby-doc.org/core/classes/IO.html git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4821 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -25,6 +25,10 @@ module Redmine
|
||||
|
||||
class AbstractAdapter #:nodoc:
|
||||
class << self
|
||||
def client_command
|
||||
""
|
||||
end
|
||||
|
||||
# Returns the version of the scm client
|
||||
# Eg: [1, 5, 0] or [] if unknown
|
||||
def client_version
|
||||
@@ -45,8 +49,20 @@ module Redmine
|
||||
def client_version_above?(v, options={})
|
||||
((client_version <=> v) >= 0) || (client_version.empty? && options[:unknown])
|
||||
end
|
||||
|
||||
def client_available
|
||||
true
|
||||
end
|
||||
|
||||
def shell_quote(str)
|
||||
if Redmine::Platform.mswin?
|
||||
'"' + str.gsub(/"/, '\\"') + '"'
|
||||
else
|
||||
"'" + str.gsub(/'/, "'\"'\"'") + "'"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def initialize(url, root_url=nil, login=nil, password=nil)
|
||||
@url = url
|
||||
@login = login if login && !login.empty?
|
||||
@@ -138,7 +154,7 @@ module Redmine
|
||||
path ||= ''
|
||||
(path[-1,1] == "/") ? path : "#{path}/"
|
||||
end
|
||||
|
||||
|
||||
def without_leading_slash(path)
|
||||
path ||= ''
|
||||
path.gsub(%r{^/+}, '')
|
||||
@@ -148,13 +164,9 @@ module Redmine
|
||||
path ||= ''
|
||||
(path[-1,1] == "/") ? path[0..-2] : path
|
||||
end
|
||||
|
||||
|
||||
def shell_quote(str)
|
||||
if Redmine::Platform.mswin?
|
||||
'"' + str.gsub(/"/, '\\"') + '"'
|
||||
else
|
||||
"'" + str.gsub(/'/, "'\"'\"'") + "'"
|
||||
end
|
||||
self.class.shell_quote(str)
|
||||
end
|
||||
|
||||
private
|
||||
@@ -168,11 +180,11 @@ module Redmine
|
||||
base = path.match(/^\//) ? root_url : url
|
||||
shell_quote("#{base}/#{path}".gsub(/[?<>\*]/, ''))
|
||||
end
|
||||
|
||||
|
||||
def logger
|
||||
self.class.logger
|
||||
end
|
||||
|
||||
|
||||
def shellout(cmd, &block)
|
||||
self.class.shellout(cmd, &block)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user