scm: catch exception of getting command and version in model (#4273).
If command does not exist, Windows raises exception in shellout(). Linux does not raise exception. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4882 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3861214ccc
commit
a092f5e0b9
|
@ -187,7 +187,7 @@ class Repository < ActiveRecord::Base
|
|||
begin
|
||||
project.repository.fetch_changesets
|
||||
rescue Redmine::Scm::Adapters::CommandFailed => e
|
||||
logger.error "Repository: error during fetching changesets: #{e.message}"
|
||||
logger.error "scm: error during fetching changesets: #{e.message}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -218,15 +218,33 @@ class Repository < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.scm_command
|
||||
self.scm_adapter_class.nil? ? "" : self.scm_adapter_class.client_command
|
||||
ret = ""
|
||||
begin
|
||||
ret = self.scm_adapter_class.client_command if self.scm_adapter_class
|
||||
rescue Redmine::Scm::Adapters::CommandFailed => e
|
||||
logger.error "scm: error during get command: #{e.message}"
|
||||
end
|
||||
ret
|
||||
end
|
||||
|
||||
def self.scm_version_string
|
||||
self.scm_adapter_class.nil? ? "" : self.scm_adapter_class.client_version_string
|
||||
ret = ""
|
||||
begin
|
||||
ret = self.scm_adapter_class.client_version_string if self.scm_adapter_class
|
||||
rescue Redmine::Scm::Adapters::CommandFailed => e
|
||||
logger.error "scm: error during get version string: #{e.message}"
|
||||
end
|
||||
ret
|
||||
end
|
||||
|
||||
def self.scm_available
|
||||
self.scm_adapter_class.nil? ? false : self.scm_adapter_class.client_available
|
||||
ret = false
|
||||
begin
|
||||
ret = self.scm_adapter_class.client_available if self.scm_adapter_class
|
||||
rescue Redmine::Scm::Adapters::CommandFailed => e
|
||||
logger.error "scm: error during get scm available: #{e.message}"
|
||||
end
|
||||
ret
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in New Issue