add local cache repository for speed purpose (subversion) or for browsing a external repository

for SCM that can handle only local copy (git).


git-svn-id: http://redmine.rubyforge.org/svn/branches/nbc@1899 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Nicolas Chuche
2008-09-22 18:46:46 +00:00
parent 9b94342bc3
commit 89b8bf3dc5
41 changed files with 216 additions and 12 deletions

View File

@@ -127,4 +127,26 @@ class RepositoryTest < Test::Unit::TestCase
assert_equal ':pserver:login:password@host:/path/to/the/repository', repository.url
assert_equal 'foo', repository.root_url
end
def test_local_cache
dir = Setting.repositories_cache_directory.gsub(/^([^#{File::SEPARATOR}].*)/, RAILS_ROOT + '/\1')
project = projects(:projects_001)
repository = Repository::Git.new(:project => Project.find_by_name(project.name), :url => "git://github.com/olabini/paipr.git")
repository.scm
assert_equal(dir + project.identifier, repository.cache_path)
repository = Repository::Git.new(:project => Project.find(:first), :url => "/var/cache/git/paipr/.git")
repository.init_cache
assert repository.cache_path.blank?
repository = Repository::Subversion.new(:project => Project.find(:first), :url => "svn://github.com/olabini/paipr.git")
repository.init_cache
assert repository.cache_path.blank?
repository = Repository::Subversion.new(:project => Project.find_by_name(project.name), :url => "svn://github.com/olabini/paipr.git", :cache => true)
repository.init_cache
assert_equal(dir + project.identifier, repository.cache_path)
end
end