git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4941 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
2195984e35
commit
07b94a25f6
|
@ -26,12 +26,12 @@ class Repository < ActiveRecord::Base
|
||||||
|
|
||||||
# Checks if the SCM is enabled when creating a repository
|
# Checks if the SCM is enabled when creating a repository
|
||||||
validate_on_create { |r| r.errors.add(:type, :invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) }
|
validate_on_create { |r| r.errors.add(:type, :invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) }
|
||||||
|
|
||||||
# Removes leading and trailing whitespace
|
# Removes leading and trailing whitespace
|
||||||
def url=(arg)
|
def url=(arg)
|
||||||
write_attribute(:url, arg ? arg.to_s.strip : nil)
|
write_attribute(:url, arg ? arg.to_s.strip : nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Removes leading and trailing whitespace
|
# Removes leading and trailing whitespace
|
||||||
def root_url=(arg)
|
def root_url=(arg)
|
||||||
write_attribute(:root_url, arg ? arg.to_s.strip : nil)
|
write_attribute(:root_url, arg ? arg.to_s.strip : nil)
|
||||||
|
@ -42,11 +42,12 @@ class Repository < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def scm
|
def scm
|
||||||
@scm ||= self.scm_adapter.new url, root_url, login, password
|
@scm ||= self.scm_adapter.new(url, root_url,
|
||||||
|
login, password, path_encoding)
|
||||||
update_attribute(:root_url, @scm.root_url) if root_url.blank?
|
update_attribute(:root_url, @scm.root_url) if root_url.blank?
|
||||||
@scm
|
@scm
|
||||||
end
|
end
|
||||||
|
|
||||||
def scm_name
|
def scm_name
|
||||||
self.class.scm_name
|
self.class.scm_name
|
||||||
end
|
end
|
||||||
|
@ -248,7 +249,7 @@ class Repository < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def before_save
|
def before_save
|
||||||
# Strips url and root_url
|
# Strips url and root_url
|
||||||
url.strip!
|
url.strip!
|
||||||
|
|
|
@ -34,14 +34,14 @@ module Redmine
|
||||||
def client_version
|
def client_version
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the version string of the scm client
|
# Returns the version string of the scm client
|
||||||
# Eg: '1.5.0' or 'Unknown version' if unknown
|
# Eg: '1.5.0' or 'Unknown version' if unknown
|
||||||
def client_version_string
|
def client_version_string
|
||||||
v = client_version || 'Unknown version'
|
v = client_version || 'Unknown version'
|
||||||
v.is_a?(Array) ? v.join('.') : v.to_s
|
v.is_a?(Array) ? v.join('.') : v.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns true if the current client version is above
|
# Returns true if the current client version is above
|
||||||
# or equals the given one
|
# or equals the given one
|
||||||
# If option is :unknown is set to true, it will return
|
# If option is :unknown is set to true, it will return
|
||||||
|
@ -63,17 +63,18 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(url, root_url=nil, login=nil, password=nil)
|
def initialize(url, root_url=nil, login=nil, password=nil,
|
||||||
|
path_encoding=nil)
|
||||||
@url = url
|
@url = url
|
||||||
@login = login if login && !login.empty?
|
@login = login if login && !login.empty?
|
||||||
@password = (password || "") if @login
|
@password = (password || "") if @login
|
||||||
@root_url = root_url.blank? ? retrieve_root_url : root_url
|
@root_url = root_url.blank? ? retrieve_root_url : root_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def adapter_name
|
def adapter_name
|
||||||
'Abstract'
|
'Abstract'
|
||||||
end
|
end
|
||||||
|
|
||||||
def supports_cat?
|
def supports_cat?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -81,11 +82,11 @@ module Redmine
|
||||||
def supports_annotate?
|
def supports_annotate?
|
||||||
respond_to?('annotate')
|
respond_to?('annotate')
|
||||||
end
|
end
|
||||||
|
|
||||||
def root_url
|
def root_url
|
||||||
@root_url
|
@root_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def url
|
def url
|
||||||
@url
|
@url
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,8 @@ module Redmine
|
||||||
# root_url -> the good old, sometimes damned, CVSROOT
|
# root_url -> the good old, sometimes damned, CVSROOT
|
||||||
# login -> unnecessary
|
# login -> unnecessary
|
||||||
# password -> unnecessary too
|
# password -> unnecessary too
|
||||||
def initialize(url, root_url=nil, login=nil, password=nil)
|
def initialize(url, root_url=nil, login=nil, password=nil,
|
||||||
|
path_encoding=nil)
|
||||||
@url = url
|
@url = url
|
||||||
@login = login if login && !login.empty?
|
@login = login if login && !login.empty?
|
||||||
@password = (password || "") if @login
|
@password = (password || "") if @login
|
||||||
|
|
|
@ -57,7 +57,8 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(url, root_url=nil, login=nil, password=nil)
|
def initialize(url, root_url=nil, login=nil, password=nil,
|
||||||
|
path_encoding=nil)
|
||||||
@url = url
|
@url = url
|
||||||
@root_url = url
|
@root_url = url
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,9 +32,10 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(url, root_url=nil, login=nil, password=nil)
|
def initialize(url, root_url=nil, login=nil, password=nil,
|
||||||
|
path_encoding=nil)
|
||||||
@url = with_trailling_slash(url)
|
@url = with_trailling_slash(url)
|
||||||
@path_encoding = 'UTF-8'
|
@path_encoding = path_encoding || 'UTF-8'
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_path_ends(path, leading=true, trailling=true)
|
def format_path_ends(path, leading=true, trailling=true)
|
||||||
|
|
|
@ -81,9 +81,9 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(url, root_url=nil, login=nil, password=nil)
|
def initialize(url, root_url=nil, login=nil, password=nil, path_encoding=nil)
|
||||||
super
|
super
|
||||||
@path_encoding = 'UTF-8'
|
@path_encoding = path_encoding || 'UTF-8'
|
||||||
end
|
end
|
||||||
|
|
||||||
def info
|
def info
|
||||||
|
|
Loading…
Reference in New Issue