summaryrefslogtreecommitdiffstats
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-04 17:12:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-04 17:12:11 +0000
commit5597bf52a0ff767b84ded451ad86bccd33d17526 (patch)
tree38e4502aa1890cdd0c9b93d12451de81c2babb3e /app/models/repository.rb
parent99b7723f57003ced8985e440f6ef3456361fd334 (diff)
downloadredmine-5597bf52a0ff767b84ded451ad86bccd33d17526.tar.gz
redmine-5597bf52a0ff767b84ded451ad86bccd33d17526.zip
Merged r15816 (#23758).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@15818 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index be1ea93d9..8276bef34 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -363,10 +363,14 @@ class Repository < ActiveRecord::Base
end
def self.factory(klass_name, *args)
- klass = "Repository::#{klass_name}".constantize
- klass.new(*args)
- rescue
- nil
+ repository_class(klass_name).new(*args) rescue nil
+ end
+
+ def self.repository_class(class_name)
+ class_name = class_name.to_s.classify
+ if Redmine::Scm::Base.all.include?(class_name)
+ "Repository::#{class_name}".constantize
+ end
end
def self.scm_adapter_class