diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-03-18 15:48:05 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-03-18 15:48:05 +0000 |
commit | fd37f37ee4ed83f90d4a8b597c3b5ae8070e8232 (patch) | |
tree | 1a39c1ef7bdc19515afdcd8c44d2458c267351d1 /app/models/repository.rb | |
parent | db3e8616c89ba34196fd12eafb3680df9479a024 (diff) | |
download | redmine-fd37f37ee4ed83f90d4a8b597c3b5ae8070e8232.tar.gz redmine-fd37f37ee4ed83f90d4a8b597c3b5ae8070e8232.zip |
fixed problems when svn path doesn't point to the root directory of the repository.
a root_url property has been added on the repository. it's automatically retrieved the first time the repository is browsed
git-svn-id: http://redmine.rubyforge.org/svn/trunk@344 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index d6e0e11aa..16bee25a7 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -19,10 +19,18 @@ class Repository < ActiveRecord::Base belongs_to :project validates_presence_of :url validates_format_of :url, :with => /^(http|https|svn|file):\/\/.+/i - - @scm = nil def scm - @scm ||= SvnRepos::Base.new url, login, password + @scm ||= SvnRepos::Base.new url, root_url, login, password + update_attribute(:root_url, @scm.root_url) if root_url.blank? + @scm + end + + def url=(str) + unless str == self.url + self.attributes = {:root_url => nil } + @scm = nil + end + super end end |