summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-04 17:11:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-09-04 17:11:10 +0000
commit1e4678b9aed35f6681cabed3a73c16594224d1c7 (patch)
treeec6c170015866a767d1326565fde922ac46a2a1a /app/models
parentc2e1dc9799900f2c5b048c94996d9ee90ce09c15 (diff)
downloadredmine-1e4678b9aed35f6681cabed3a73c16594224d1c7.tar.gz
redmine-1e4678b9aed35f6681cabed3a73c16594224d1c7.zip
Merged r15816 (#23758).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15817 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-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