Show More
@@ -161,11 +161,10 b' def get_or_create_region(region_name, re' | |||||
161 | from vcsserver.lib.rc_cache.backends import FileNamespaceBackend |
|
161 | from vcsserver.lib.rc_cache.backends import FileNamespaceBackend | |
162 | region_obj = region_meta.dogpile_cache_regions.get(region_name) |
|
162 | region_obj = region_meta.dogpile_cache_regions.get(region_name) | |
163 | if not region_obj: |
|
163 | if not region_obj: | |
164 | raise EnvironmentError( |
|
164 | reg_keys = list(region_meta.dogpile_cache_regions.keys()) | |
165 |
|
|
165 | raise EnvironmentError(f'Region `{region_name}` not in configured: {reg_keys}.') | |
166 | region_name, list(region_meta.dogpile_cache_regions.keys()))) |
|
|||
167 |
|
166 | |||
168 |
region_uid_name = '{}:{}' |
|
167 | region_uid_name = f'{region_name}:{region_namespace}' | |
169 | if isinstance(region_obj.actual_backend, FileNamespaceBackend): |
|
168 | if isinstance(region_obj.actual_backend, FileNamespaceBackend): | |
170 | region_exist = region_meta.dogpile_cache_regions.get(region_namespace) |
|
169 | region_exist = region_meta.dogpile_cache_regions.get(region_namespace) | |
171 | if region_exist: |
|
170 | if region_exist: | |
@@ -181,7 +180,7 b' def get_or_create_region(region_name, re' | |||||
181 | function_key_generator=backend_key_generator(region_obj.actual_backend) |
|
180 | function_key_generator=backend_key_generator(region_obj.actual_backend) | |
182 | ) |
|
181 | ) | |
183 | namespace_filename = os.path.join( |
|
182 | namespace_filename = os.path.join( | |
184 |
cache_dir, "{}.cache.dbm" |
|
183 | cache_dir, f"{region_namespace}.cache.dbm") | |
185 | # special type that allows 1db per namespace |
|
184 | # special type that allows 1db per namespace | |
186 | new_region.configure( |
|
185 | new_region.configure( | |
187 | backend='dogpile.cache.rc.file_namespace', |
|
186 | backend='dogpile.cache.rc.file_namespace', |
@@ -273,6 +273,17 b' class GitRemote(RemoteBase):' | |||||
273 | return _is_binary(repo_id, tree_id) |
|
273 | return _is_binary(repo_id, tree_id) | |
274 |
|
274 | |||
275 | @reraise_safe_exceptions |
|
275 | @reraise_safe_exceptions | |
|
276 | def md5_hash(self, wire, tree_id): | |||
|
277 | cache_on, context_uid, repo_id = self._cache_on(wire) | |||
|
278 | region = self._region(wire) | |||
|
279 | ||||
|
280 | @region.conditional_cache_on_arguments(condition=cache_on) | |||
|
281 | def _md5_hash(_repo_id, _tree_id): | |||
|
282 | return '' | |||
|
283 | ||||
|
284 | return _md5_hash(repo_id, tree_id) | |||
|
285 | ||||
|
286 | @reraise_safe_exceptions | |||
276 | def in_largefiles_store(self, wire, oid): |
|
287 | def in_largefiles_store(self, wire, oid): | |
277 | conf = self._wire_to_config(wire) |
|
288 | conf = self._wire_to_config(wire) | |
278 | repo_init = self._factory.repo_libgit2(wire) |
|
289 | repo_init = self._factory.repo_libgit2(wire) |
@@ -623,6 +623,20 b' class HgRemote(RemoteBase):' | |||||
623 | return _is_binary(repo_id, revision, path) |
|
623 | return _is_binary(repo_id, revision, path) | |
624 |
|
624 | |||
625 | @reraise_safe_exceptions |
|
625 | @reraise_safe_exceptions | |
|
626 | def md5_hash(self, wire, revision, path): | |||
|
627 | cache_on, context_uid, repo_id = self._cache_on(wire) | |||
|
628 | region = self._region(wire) | |||
|
629 | ||||
|
630 | @region.conditional_cache_on_arguments(condition=cache_on) | |||
|
631 | def _md5_hash(_repo_id, _sha, _path): | |||
|
632 | repo = self._factory.repo(wire) | |||
|
633 | ctx = self._get_ctx(repo, revision) | |||
|
634 | fctx = ctx.filectx(safe_bytes(path)) | |||
|
635 | return hashlib.md5(fctx.data()).hexdigest() | |||
|
636 | ||||
|
637 | return _md5_hash(repo_id, revision, path) | |||
|
638 | ||||
|
639 | @reraise_safe_exceptions | |||
626 | def in_largefiles_store(self, wire, sha): |
|
640 | def in_largefiles_store(self, wire, sha): | |
627 | repo = self._factory.repo(wire) |
|
641 | repo = self._factory.repo(wire) | |
628 | return largefiles.lfutil.instore(repo, sha) |
|
642 | return largefiles.lfutil.instore(repo, sha) |
@@ -472,8 +472,8 b' class SvnRemote(RemoteBase):' | |||||
472 | @reraise_safe_exceptions |
|
472 | @reraise_safe_exceptions | |
473 | def is_binary(self, wire, rev, path): |
|
473 | def is_binary(self, wire, rev, path): | |
474 | cache_on, context_uid, repo_id = self._cache_on(wire) |
|
474 | cache_on, context_uid, repo_id = self._cache_on(wire) | |
|
475 | region = self._region(wire) | |||
475 |
|
476 | |||
476 | region = self._region(wire) |
|
|||
477 | @region.conditional_cache_on_arguments(condition=cache_on) |
|
477 | @region.conditional_cache_on_arguments(condition=cache_on) | |
478 | def _is_binary(_repo_id, _rev, _path): |
|
478 | def _is_binary(_repo_id, _rev, _path): | |
479 | raw_bytes = self.get_file_content(wire, path, rev) |
|
479 | raw_bytes = self.get_file_content(wire, path, rev) | |
@@ -482,6 +482,17 b' class SvnRemote(RemoteBase):' | |||||
482 | return _is_binary(repo_id, rev, path) |
|
482 | return _is_binary(repo_id, rev, path) | |
483 |
|
483 | |||
484 | @reraise_safe_exceptions |
|
484 | @reraise_safe_exceptions | |
|
485 | def md5_hash(self, wire, rev, path): | |||
|
486 | cache_on, context_uid, repo_id = self._cache_on(wire) | |||
|
487 | region = self._region(wire) | |||
|
488 | ||||
|
489 | @region.conditional_cache_on_arguments(condition=cache_on) | |||
|
490 | def _md5_hash(_repo_id, _rev, _path): | |||
|
491 | return '' | |||
|
492 | ||||
|
493 | return _md5_hash(repo_id, rev, path) | |||
|
494 | ||||
|
495 | @reraise_safe_exceptions | |||
485 | def run_svn_command(self, wire, cmd, **opts): |
|
496 | def run_svn_command(self, wire, cmd, **opts): | |
486 | path = wire.get('path', None) |
|
497 | path = wire.get('path', None) | |
487 |
|
498 |
General Comments 0
You need to be logged in to leave comments.
Login now