mirror of
https://github.com/redmine/redmine.git
synced 2026-05-07 00:46:07 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user