Show More
@@ -305,6 +305,11 b' class RepoAppView(BaseAppView):' | |||
|
305 | 305 | settings = settings_model.get_general_settings() |
|
306 | 306 | return settings.get(settings_key, default) |
|
307 | 307 | |
|
308 | def _get_repo_setting(self, target_repo, settings_key, default=False): | |
|
309 | settings_model = VcsSettingsModel(repo=target_repo) | |
|
310 | settings = settings_model.get_repo_settings_inherited() | |
|
311 | return settings.get(settings_key, default) | |
|
312 | ||
|
308 | 313 | def get_recache_flag(self): |
|
309 | 314 | for flag_name in ['force_recache', 'force-recache', 'no-cache']: |
|
310 | 315 | flag_val = self.request.GET.get(flag_name) |
@@ -305,6 +305,21 b' class RepoFilesView(RepoAppView):' | |||
|
305 | 305 | pure_path = pathlib2.PurePath(*sanitized_path) |
|
306 | 306 | return pure_path |
|
307 | 307 | |
|
308 | def _is_lf_enabled(self, target_repo): | |
|
309 | lf_enabled = False | |
|
310 | ||
|
311 | lf_key_for_vcs_map = { | |
|
312 | 'hg': 'extensions_largefiles', | |
|
313 | 'git': 'vcs_git_lfs_enabled' | |
|
314 | } | |
|
315 | ||
|
316 | lf_key_for_vcs = lf_key_for_vcs_map.get(target_repo.repo_type) | |
|
317 | ||
|
318 | if lf_key_for_vcs: | |
|
319 | lf_enabled = self._get_repo_setting(target_repo, lf_key_for_vcs) | |
|
320 | ||
|
321 | return lf_enabled | |
|
322 | ||
|
308 | 323 | @LoginRequired() |
|
309 | 324 | @HasRepoPermissionAnyDecorator( |
|
310 | 325 | 'repository.read', 'repository.write', 'repository.admin') |
@@ -645,6 +660,10 b' class RepoFilesView(RepoAppView):' | |||
|
645 | 660 | |
|
646 | 661 | # load file content |
|
647 | 662 | if c.file.is_file(): |
|
663 | c.lf_node = {} | |
|
664 | ||
|
665 | has_lf_enabled = self._is_lf_enabled(self.db_repo) | |
|
666 | if has_lf_enabled: | |
|
648 | 667 | c.lf_node = c.file.get_largefile_node() |
|
649 | 668 | |
|
650 | 669 | c.file_source_page = 'true' |
@@ -330,8 +330,8 b' class MercurialCommit(base.BaseCommit):' | |||
|
330 | 330 | return self.nodes[path] |
|
331 | 331 | |
|
332 | 332 | def get_largefile_node(self, path): |
|
333 | ||
|
334 | if self._remote.is_large_file(path): | |
|
333 | pointer_spec = self._remote.is_large_file(path) | |
|
334 | if pointer_spec: | |
|
335 | 335 | # content of that file regular FileNode is the hash of largefile |
|
336 | 336 | file_id = self.get_file_content(path).strip() |
|
337 | 337 |
@@ -521,6 +521,12 b' class VcsSettingsModel(object):' | |||
|
521 | 521 | return self._collect_all_settings(global_=False) |
|
522 | 522 | |
|
523 | 523 | @assert_repo_settings |
|
524 | def get_repo_settings_inherited(self): | |
|
525 | global_settings = self.get_global_settings() | |
|
526 | global_settings.update(self.get_repo_settings()) | |
|
527 | return global_settings | |
|
528 | ||
|
529 | @assert_repo_settings | |
|
524 | 530 | def create_or_update_repo_settings( |
|
525 | 531 | self, data, inherit_global_settings=False): |
|
526 | 532 | from rhodecode.model.scm import ScmModel |
General Comments 0
You need to be logged in to leave comments.
Login now