caches: make sure we init caches on repo names withou '/' to not create a new cache subpath

This commit is contained in:
RhodeCode Admin 2022-09-01 22:00:13 +02:00
parent e5a4524403
commit 093cf251d5
3 changed files with 7 additions and 3 deletions

View file

@ -168,7 +168,7 @@ class FileNamespaceBackend(PickleSerializer, file_backend.DBMBackend):
try:
super(FileNamespaceBackend, self).__init__(arguments)
except Exception:
log.error('Failed to initialize db at: %s', db_file)
log.exception('Failed to initialize db at: %s', db_file)
raise
def __repr__(self):

View file

@ -186,7 +186,7 @@ class RemoteRepo(object):
self.stream_url = remote_maker.stream_url
self._session = remote_maker._session_factory()
self._cache_region, self._cache_namespace = \
remote_maker.init_cache_region(repo_id)
remote_maker.init_cache_region(self._repo_id_sanitizer(repo_id))
with_wire = with_wire or {}
@ -209,6 +209,9 @@ class RemoteRepo(object):
self.cert_dir = get_cert_path(rhodecode.CONFIG.get('__file__'))
def _repo_id_sanitizer(self, repo_id):
return repo_id.replace('/', '__')
def __getattr__(self, name):
if name.startswith('stream:'):

View file

@ -940,7 +940,8 @@ class RepoModel(BaseModel):
if landing_rev_name.startswith('branch:'):
landing_rev_name = landing_rev_name.split('branch:')[-1]
scm_instance = repo.scm_instance()
return scm_instance._remote.set_head_ref(landing_rev_name)
if scm_instance:
return scm_instance._remote.set_head_ref(landing_rev_name)
def _create_filesystem_repo(self, repo_name, repo_type, repo_group,
clone_uri=None, repo_store_location=None,