##// END OF EJS Templates
simplevcs: handle a case of damaged filesystem repo without 500 exception.
marcink -
r2363:4c6f9023 default
parent child Browse files
Show More
@@ -230,7 +230,8 b' class SimpleVCS(object):'
230 repo_name, db_repo.repo_type, scm_type)
230 repo_name, db_repo.repo_type, scm_type)
231 return False
231 return False
232
232
233 return is_valid_repo(repo_name, base_path, explicit_scm=scm_type)
233 return is_valid_repo(repo_name, base_path,
234 explicit_scm=scm_type, expect_scm=scm_type)
234
235
235 def valid_and_active_user(self, user):
236 def valid_and_active_user(self, user):
236 """
237 """
@@ -260,7 +260,7 b' def is_valid_repo(repo_name, base_path, '
260
260
261 try:
261 try:
262 if explicit_scm:
262 if explicit_scm:
263 detected_scms = [get_scm_backend(explicit_scm)]
263 detected_scms = [get_scm_backend(explicit_scm)(full_path).alias]
264 else:
264 else:
265 detected_scms = get_scm(full_path)
265 detected_scms = get_scm(full_path)
266
266
@@ -39,6 +39,7 b' from rhodecode.lib.vcs.nodes import File'
39 from rhodecode.model.auth_token import AuthTokenModel
39 from rhodecode.model.auth_token import AuthTokenModel
40 from rhodecode.model.db import Repository, UserIpMap, CacheKey
40 from rhodecode.model.db import Repository, UserIpMap, CacheKey
41 from rhodecode.model.meta import Session
41 from rhodecode.model.meta import Session
42 from rhodecode.model.repo import RepoModel
42 from rhodecode.model.user import UserModel
43 from rhodecode.model.user import UserModel
43 from rhodecode.tests import (GIT_REPO, HG_REPO, TEST_USER_ADMIN_LOGIN)
44 from rhodecode.tests import (GIT_REPO, HG_REPO, TEST_USER_ADMIN_LOGIN)
44
45
@@ -177,6 +178,28 b' class TestVCSOperations(object):'
177 'git clone', clone_url, tmpdir.strpath)
178 'git clone', clone_url, tmpdir.strpath)
178 assert 'not found' in stderr
179 assert 'not found' in stderr
179
180
181 def test_clone_non_existing_store_path_hg(self, rc_web_server, tmpdir, user_util):
182 repo = user_util.create_repo()
183 clone_url = rc_web_server.repo_clone_url(repo.repo_name)
184
185 # Damage repo by removing it's folder
186 RepoModel()._delete_filesystem_repo(repo)
187
188 stdout, stderr = Command('/tmp').execute(
189 'hg clone', clone_url, tmpdir.strpath)
190 assert 'HTTP Error 404: Not Found' in stderr
191
192 def test_clone_non_existing_store_path_git(self, rc_web_server, tmpdir, user_util):
193 repo = user_util.create_repo(repo_type='git')
194 clone_url = rc_web_server.repo_clone_url(repo.repo_name)
195
196 # Damage repo by removing it's folder
197 RepoModel()._delete_filesystem_repo(repo)
198
199 stdout, stderr = Command('/tmp').execute(
200 'git clone', clone_url, tmpdir.strpath)
201 assert 'not found' in stderr
202
180 def test_push_new_file_hg(self, rc_web_server, tmpdir):
203 def test_push_new_file_hg(self, rc_web_server, tmpdir):
181 clone_url = rc_web_server.repo_clone_url(HG_REPO)
204 clone_url = rc_web_server.repo_clone_url(HG_REPO)
182 stdout, stderr = Command('/tmp').execute(
205 stdout, stderr = Command('/tmp').execute(
General Comments 0
You need to be logged in to leave comments. Login now