diff --git a/configs/development.ini b/configs/development.ini --- a/configs/development.ini +++ b/configs/development.ini @@ -689,6 +689,12 @@ vcs.connection_timeout = 3600 ; It uses cache_region `cache_repo` vcs.methods.cache = true +; Filesystem location where Git lfs objects should be stored +vcs.git.lfs.storage_location = /var/opt/rhodecode_repo_store/.cache/git_lfs_store + +; Filesystem location where Mercurial largefile objects should be stored +vcs.hg.largefiles.storage_location = /var/opt/rhodecode_repo_store/.cache/hg_largefiles_store + ; #################################################### ; Subversion proxy support (mod_dav_svn) ; Maps RhodeCode repo groups into SVN paths for Apache diff --git a/configs/production.ini b/configs/production.ini --- a/configs/production.ini +++ b/configs/production.ini @@ -657,6 +657,12 @@ vcs.connection_timeout = 3600 ; It uses cache_region `cache_repo` vcs.methods.cache = true +; Filesystem location where Git lfs objects should be stored +vcs.git.lfs.storage_location = /var/opt/rhodecode_repo_store/.cache/git_lfs_store + +; Filesystem location where Mercurial largefile objects should be stored +vcs.hg.largefiles.storage_location = /var/opt/rhodecode_repo_store/.cache/hg_largefiles_store + ; #################################################### ; Subversion proxy support (mod_dav_svn) ; Maps RhodeCode repo groups into SVN paths for Apache diff --git a/rhodecode/config/config_maker.py b/rhodecode/config/config_maker.py --- a/rhodecode/config/config_maker.py +++ b/rhodecode/config/config_maker.py @@ -116,6 +116,9 @@ def sanitize_settings_and_apply_defaults settings_maker.make_setting('vcs.start_server', 'false', parser='bool') settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list') settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int') + settings_maker.make_setting('vcs.git.lfs.storage_location', '/var/opt/rhodecode_repo_store/.cache/git_lfs_store') + settings_maker.make_setting('vcs.hg.largefiles.storage_location', + '/var/opt/rhodecode_repo_store/.cache/hg_largefiles_store') settings_maker.make_setting('vcs.methods.cache', True, parser='bool') diff --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -42,6 +42,7 @@ from webhelpers2.text import collapse, s from mako import exceptions +from rhodecode import ConfigGet from rhodecode.lib.hash_utils import sha256_safe, md5, sha1 from rhodecode.lib.type_utils import AttributeDict from rhodecode.lib.str_utils import safe_bytes, safe_str @@ -364,9 +365,9 @@ ui_sections = [ 'ui', 'web', ] -def config_data_from_db(clear_session=True, repo=None): +def prepare_config_data(clear_session=True, repo=None): """ - Read the configuration data from the database and return configuration + Read the configuration data from the database, *.ini files and return configuration tuples. """ from rhodecode.model.settings import VcsSettingsModel @@ -380,6 +381,10 @@ def config_data_from_db(clear_session=Tr ui_data = [] for setting in ui_settings: + # Todo: remove this section once transition to *.ini files will be completed + if setting.section in ('largefiles', 'vcs_git_lfs'): + if setting.key != 'enabled': + continue if setting.active: ui_data.append((setting.section, setting.key, setting.value)) config.append(( @@ -390,6 +395,9 @@ def config_data_from_db(clear_session=Tr # handles that config.append(( safe_str(setting.section), safe_str(setting.key), False)) + config_getter = ConfigGet() + config.append(('vcs_git_lfs', 'store_location', config_getter.get_str('vcs.git.lfs.storage_location'))) + config.append(('largefiles', 'usercache', config_getter.get_str('vcs.hg.largefiles.storage_location'))) log.debug( 'settings ui from db@repo[%s]: %s', repo, @@ -418,7 +426,7 @@ def make_db_config(clear_session=True, r Create a :class:`Config` instance based on the values in the database. """ config = Config() - config_data = config_data_from_db(clear_session=clear_session, repo=repo) + config_data = prepare_config_data(clear_session=clear_session, repo=repo) for section, option, value in config_data: config.set(section, option, value) return config diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -469,12 +469,6 @@ def ApplicationUiSettingsForm(localizer) class _ApplicationUiSettingsForm(_BaseVcsSettingsForm): web_push_ssl = v.StringBoolean(if_missing=False) - largefiles_usercache = All( - v.ValidPath(localizer), - v.UnicodeString(strip=True, min=2, not_empty=True)) - vcs_git_lfs_store_location = All( - v.ValidPath(localizer), - v.UnicodeString(strip=True, min=2, not_empty=True)) extensions_hggit = v.StringBoolean(if_missing=False) new_svn_branch = v.ValidSvnPattern(localizer, section='vcs_svn_branch') new_svn_tag = v.ValidSvnPattern(localizer, section='vcs_svn_tag') diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -486,7 +486,6 @@ class VcsSettingsModel(object): ) GLOBAL_HG_SETTINGS = ( ('extensions', 'largefiles'), - ('largefiles', 'usercache'), ('phases', 'publish'), ('extensions', 'evolve'), ('extensions', 'topic'), @@ -496,7 +495,6 @@ class VcsSettingsModel(object): GLOBAL_GIT_SETTINGS = ( ('vcs_git_lfs', 'enabled'), - ('vcs_git_lfs', 'store_location') ) SVN_BRANCH_SECTION = 'vcs_svn_branch' @@ -666,18 +664,16 @@ class VcsSettingsModel(object): self.repo_settings, *phases, value=safe_str(data[phases_key])) def create_or_update_global_hg_settings(self, data): - opts_len = 4 - largefiles, largefiles_store, phases, evolve \ + opts_len = 3 + largefiles, phases, evolve \ = self.GLOBAL_HG_SETTINGS[:opts_len] - largefiles_key, largefiles_store_key, phases_key, evolve_key \ + largefiles_key, phases_key, evolve_key \ = self._get_settings_keys(self.GLOBAL_HG_SETTINGS[:opts_len], data) self._create_or_update_ui( self.global_settings, *largefiles, value='', active=data[largefiles_key]) self._create_or_update_ui( - self.global_settings, *largefiles_store, value=data[largefiles_store_key]) - self._create_or_update_ui( self.global_settings, *phases, value=safe_str(data[phases_key])) self._create_or_update_ui( self.global_settings, *evolve, value='', @@ -697,17 +693,12 @@ class VcsSettingsModel(object): active=data[lfs_enabled_key]) def create_or_update_global_git_settings(self, data): - lfs_enabled, lfs_store_location \ - = self.GLOBAL_GIT_SETTINGS - lfs_enabled_key, lfs_store_location_key \ - = self._get_settings_keys(self.GLOBAL_GIT_SETTINGS, data) + lfs_enabled = self.GLOBAL_GIT_SETTINGS[0] + lfs_enabled_key = self._get_settings_keys(self.GLOBAL_GIT_SETTINGS, data)[0] self._create_or_update_ui( self.global_settings, *lfs_enabled, value=data[lfs_enabled_key], active=data[lfs_enabled_key]) - self._create_or_update_ui( - self.global_settings, *lfs_store_location, - value=data[lfs_store_location_key]) def create_or_update_global_svn_settings(self, data): # branch/tags patterns diff --git a/rhodecode/templates/base/vcs_settings.mako b/rhodecode/templates/base/vcs_settings.mako --- a/rhodecode/templates/base/vcs_settings.mako +++ b/rhodecode/templates/base/vcs_settings.mako @@ -75,17 +75,6 @@ % endif - % if display_globals: -