##// END OF EJS Templates
feat(git lfs path and path to hg large files in *.ini files): moved git lfs path and path of hg large files to *.ini files.
ilin.s -
r5535:7350be7a default
parent child Browse files
Show More
@@ -689,6 +689,12 b' vcs.connection_timeout = 3600'
689 ; It uses cache_region `cache_repo`
689 ; It uses cache_region `cache_repo`
690 vcs.methods.cache = true
690 vcs.methods.cache = true
691
691
692 ; Filesystem location where Git lfs objects should be stored
693 vcs.git.lfs.storage_location = /var/opt/rhodecode_repo_store/.cache/git_lfs_store
694
695 ; Filesystem location where Mercurial largefile objects should be stored
696 vcs.hg.largefiles.storage_location = /var/opt/rhodecode_repo_store/.cache/hg_largefiles_store
697
692 ; ####################################################
698 ; ####################################################
693 ; Subversion proxy support (mod_dav_svn)
699 ; Subversion proxy support (mod_dav_svn)
694 ; Maps RhodeCode repo groups into SVN paths for Apache
700 ; Maps RhodeCode repo groups into SVN paths for Apache
@@ -657,6 +657,12 b' vcs.connection_timeout = 3600'
657 ; It uses cache_region `cache_repo`
657 ; It uses cache_region `cache_repo`
658 vcs.methods.cache = true
658 vcs.methods.cache = true
659
659
660 ; Filesystem location where Git lfs objects should be stored
661 vcs.git.lfs.storage_location = /var/opt/rhodecode_repo_store/.cache/git_lfs_store
662
663 ; Filesystem location where Mercurial largefile objects should be stored
664 vcs.hg.largefiles.storage_location = /var/opt/rhodecode_repo_store/.cache/hg_largefiles_store
665
660 ; ####################################################
666 ; ####################################################
661 ; Subversion proxy support (mod_dav_svn)
667 ; Subversion proxy support (mod_dav_svn)
662 ; Maps RhodeCode repo groups into SVN paths for Apache
668 ; Maps RhodeCode repo groups into SVN paths for Apache
@@ -116,6 +116,9 b' def sanitize_settings_and_apply_defaults'
116 settings_maker.make_setting('vcs.start_server', 'false', parser='bool')
116 settings_maker.make_setting('vcs.start_server', 'false', parser='bool')
117 settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list')
117 settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list')
118 settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int')
118 settings_maker.make_setting('vcs.connection_timeout', 3600, parser='int')
119 settings_maker.make_setting('vcs.git.lfs.storage_location', '/var/opt/rhodecode_repo_store/.cache/git_lfs_store')
120 settings_maker.make_setting('vcs.hg.largefiles.storage_location',
121 '/var/opt/rhodecode_repo_store/.cache/hg_largefiles_store')
119
122
120 settings_maker.make_setting('vcs.methods.cache', True, parser='bool')
123 settings_maker.make_setting('vcs.methods.cache', True, parser='bool')
121
124
@@ -42,6 +42,7 b' from webhelpers2.text import collapse, s'
42
42
43 from mako import exceptions
43 from mako import exceptions
44
44
45 from rhodecode import ConfigGet
45 from rhodecode.lib.hash_utils import sha256_safe, md5, sha1
46 from rhodecode.lib.hash_utils import sha256_safe, md5, sha1
46 from rhodecode.lib.type_utils import AttributeDict
47 from rhodecode.lib.type_utils import AttributeDict
47 from rhodecode.lib.str_utils import safe_bytes, safe_str
48 from rhodecode.lib.str_utils import safe_bytes, safe_str
@@ -364,9 +365,9 b' ui_sections = ['
364 'ui', 'web', ]
365 'ui', 'web', ]
365
366
366
367
367 def config_data_from_db(clear_session=True, repo=None):
368 def prepare_config_data(clear_session=True, repo=None):
368 """
369 """
369 Read the configuration data from the database and return configuration
370 Read the configuration data from the database, *.ini files and return configuration
370 tuples.
371 tuples.
371 """
372 """
372 from rhodecode.model.settings import VcsSettingsModel
373 from rhodecode.model.settings import VcsSettingsModel
@@ -380,6 +381,10 b' def config_data_from_db(clear_session=Tr'
380
381
381 ui_data = []
382 ui_data = []
382 for setting in ui_settings:
383 for setting in ui_settings:
384 # Todo: remove this section once transition to *.ini files will be completed
385 if setting.section in ('largefiles', 'vcs_git_lfs'):
386 if setting.key != 'enabled':
387 continue
383 if setting.active:
388 if setting.active:
384 ui_data.append((setting.section, setting.key, setting.value))
389 ui_data.append((setting.section, setting.key, setting.value))
385 config.append((
390 config.append((
@@ -390,6 +395,9 b' def config_data_from_db(clear_session=Tr'
390 # handles that
395 # handles that
391 config.append((
396 config.append((
392 safe_str(setting.section), safe_str(setting.key), False))
397 safe_str(setting.section), safe_str(setting.key), False))
398 config_getter = ConfigGet()
399 config.append(('vcs_git_lfs', 'store_location', config_getter.get_str('vcs.git.lfs.storage_location')))
400 config.append(('largefiles', 'usercache', config_getter.get_str('vcs.hg.largefiles.storage_location')))
393 log.debug(
401 log.debug(
394 'settings ui from db@repo[%s]: %s',
402 'settings ui from db@repo[%s]: %s',
395 repo,
403 repo,
@@ -418,7 +426,7 b' def make_db_config(clear_session=True, r'
418 Create a :class:`Config` instance based on the values in the database.
426 Create a :class:`Config` instance based on the values in the database.
419 """
427 """
420 config = Config()
428 config = Config()
421 config_data = config_data_from_db(clear_session=clear_session, repo=repo)
429 config_data = prepare_config_data(clear_session=clear_session, repo=repo)
422 for section, option, value in config_data:
430 for section, option, value in config_data:
423 config.set(section, option, value)
431 config.set(section, option, value)
424 return config
432 return config
@@ -469,12 +469,6 b' def ApplicationUiSettingsForm(localizer)'
469
469
470 class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
470 class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
471 web_push_ssl = v.StringBoolean(if_missing=False)
471 web_push_ssl = v.StringBoolean(if_missing=False)
472 largefiles_usercache = All(
473 v.ValidPath(localizer),
474 v.UnicodeString(strip=True, min=2, not_empty=True))
475 vcs_git_lfs_store_location = All(
476 v.ValidPath(localizer),
477 v.UnicodeString(strip=True, min=2, not_empty=True))
478 extensions_hggit = v.StringBoolean(if_missing=False)
472 extensions_hggit = v.StringBoolean(if_missing=False)
479 new_svn_branch = v.ValidSvnPattern(localizer, section='vcs_svn_branch')
473 new_svn_branch = v.ValidSvnPattern(localizer, section='vcs_svn_branch')
480 new_svn_tag = v.ValidSvnPattern(localizer, section='vcs_svn_tag')
474 new_svn_tag = v.ValidSvnPattern(localizer, section='vcs_svn_tag')
@@ -486,7 +486,6 b' class VcsSettingsModel(object):'
486 )
486 )
487 GLOBAL_HG_SETTINGS = (
487 GLOBAL_HG_SETTINGS = (
488 ('extensions', 'largefiles'),
488 ('extensions', 'largefiles'),
489 ('largefiles', 'usercache'),
490 ('phases', 'publish'),
489 ('phases', 'publish'),
491 ('extensions', 'evolve'),
490 ('extensions', 'evolve'),
492 ('extensions', 'topic'),
491 ('extensions', 'topic'),
@@ -496,7 +495,6 b' class VcsSettingsModel(object):'
496
495
497 GLOBAL_GIT_SETTINGS = (
496 GLOBAL_GIT_SETTINGS = (
498 ('vcs_git_lfs', 'enabled'),
497 ('vcs_git_lfs', 'enabled'),
499 ('vcs_git_lfs', 'store_location')
500 )
498 )
501
499
502 SVN_BRANCH_SECTION = 'vcs_svn_branch'
500 SVN_BRANCH_SECTION = 'vcs_svn_branch'
@@ -666,18 +664,16 b' class VcsSettingsModel(object):'
666 self.repo_settings, *phases, value=safe_str(data[phases_key]))
664 self.repo_settings, *phases, value=safe_str(data[phases_key]))
667
665
668 def create_or_update_global_hg_settings(self, data):
666 def create_or_update_global_hg_settings(self, data):
669 opts_len = 4
667 opts_len = 3
670 largefiles, largefiles_store, phases, evolve \
668 largefiles, phases, evolve \
671 = self.GLOBAL_HG_SETTINGS[:opts_len]
669 = self.GLOBAL_HG_SETTINGS[:opts_len]
672 largefiles_key, largefiles_store_key, phases_key, evolve_key \
670 largefiles_key, phases_key, evolve_key \
673 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS[:opts_len], data)
671 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS[:opts_len], data)
674
672
675 self._create_or_update_ui(
673 self._create_or_update_ui(
676 self.global_settings, *largefiles, value='',
674 self.global_settings, *largefiles, value='',
677 active=data[largefiles_key])
675 active=data[largefiles_key])
678 self._create_or_update_ui(
676 self._create_or_update_ui(
679 self.global_settings, *largefiles_store, value=data[largefiles_store_key])
680 self._create_or_update_ui(
681 self.global_settings, *phases, value=safe_str(data[phases_key]))
677 self.global_settings, *phases, value=safe_str(data[phases_key]))
682 self._create_or_update_ui(
678 self._create_or_update_ui(
683 self.global_settings, *evolve, value='',
679 self.global_settings, *evolve, value='',
@@ -697,17 +693,12 b' class VcsSettingsModel(object):'
697 active=data[lfs_enabled_key])
693 active=data[lfs_enabled_key])
698
694
699 def create_or_update_global_git_settings(self, data):
695 def create_or_update_global_git_settings(self, data):
700 lfs_enabled, lfs_store_location \
696 lfs_enabled = self.GLOBAL_GIT_SETTINGS[0]
701 = self.GLOBAL_GIT_SETTINGS
697 lfs_enabled_key = self._get_settings_keys(self.GLOBAL_GIT_SETTINGS, data)[0]
702 lfs_enabled_key, lfs_store_location_key \
703 = self._get_settings_keys(self.GLOBAL_GIT_SETTINGS, data)
704
698
705 self._create_or_update_ui(
699 self._create_or_update_ui(
706 self.global_settings, *lfs_enabled, value=data[lfs_enabled_key],
700 self.global_settings, *lfs_enabled, value=data[lfs_enabled_key],
707 active=data[lfs_enabled_key])
701 active=data[lfs_enabled_key])
708 self._create_or_update_ui(
709 self.global_settings, *lfs_store_location,
710 value=data[lfs_store_location_key])
711
702
712 def create_or_update_global_svn_settings(self, data):
703 def create_or_update_global_svn_settings(self, data):
713 # branch/tags patterns
704 # branch/tags patterns
@@ -75,17 +75,6 b''
75 % endif
75 % endif
76 </div>
76 </div>
77
77
78 % if display_globals:
79 <div class="field">
80 <div class="input">
81 ${h.text('largefiles_usercache' + suffix, size=59)}
82 </div>
83 </div>
84 <div class="label">
85 <span class="help-block">${_('Filesystem location where Mercurial largefile objects should be stored.')}</span>
86 </div>
87 % endif
88
89 <div class="checkbox">
78 <div class="checkbox">
90 ${h.checkbox('phases_publish' + suffix, 'True', **kwargs)}
79 ${h.checkbox('phases_publish' + suffix, 'True', **kwargs)}
91 <label for="phases_publish${suffix}">${_('Set repositories as publishing') if display_globals else _('Set repository as publishing')}</label>
80 <label for="phases_publish${suffix}">${_('Set repositories as publishing') if display_globals else _('Set repository as publishing')}</label>
@@ -127,17 +116,6 b''
127 <span class="help-block">${_('Enable lfs extensions for this repository.')}</span>
116 <span class="help-block">${_('Enable lfs extensions for this repository.')}</span>
128 % endif
117 % endif
129 </div>
118 </div>
130
131 % if display_globals:
132 <div class="field">
133 <div class="input">
134 ${h.text('vcs_git_lfs_store_location' + suffix, size=59)}
135 </div>
136 </div>
137 <div class="label">
138 <span class="help-block">${_('Filesystem location where Git lfs objects should be stored.')}</span>
139 </div>
140 % endif
141 </div>
119 </div>
142 </div>
120 </div>
143 % endif
121 % endif
@@ -371,7 +371,7 b' class TestMakeDbConfig(object):'
371 ('section2', 'option2', 'value2'),
371 ('section2', 'option2', 'value2'),
372 ('section3', 'option3', 'value3'),
372 ('section3', 'option3', 'value3'),
373 ]
373 ]
374 with mock.patch.object(utils, 'config_data_from_db') as config_mock:
374 with mock.patch.object(utils, 'prepare_config_data') as config_mock:
375 config_mock.return_value = test_data
375 config_mock.return_value = test_data
376 kwargs = {'clear_session': False, 'repo': 'test_repo'}
376 kwargs = {'clear_session': False, 'repo': 'test_repo'}
377 result = utils.make_db_config(**kwargs)
377 result = utils.make_db_config(**kwargs)
@@ -381,8 +381,8 b' class TestMakeDbConfig(object):'
381 assert value == expected_value
381 assert value == expected_value
382
382
383
383
384 class TestConfigDataFromDb(object):
384 class TestPrepareConfigData(object):
385 def test_config_data_from_db_returns_active_settings(self):
385 def test_prepare_config_data_returns_active_settings(self):
386 test_data = [
386 test_data = [
387 UiSetting('section1', 'option1', 'value1', True),
387 UiSetting('section1', 'option1', 'value1', True),
388 UiSetting('section2', 'option2', 'value2', True),
388 UiSetting('section2', 'option2', 'value2', True),
@@ -398,7 +398,7 b' class TestConfigDataFromDb(object):'
398 instance_mock = mock.Mock()
398 instance_mock = mock.Mock()
399 model_mock.return_value = instance_mock
399 model_mock.return_value = instance_mock
400 instance_mock.get_ui_settings.return_value = test_data
400 instance_mock.get_ui_settings.return_value = test_data
401 result = utils.config_data_from_db(
401 result = utils.prepare_config_data(
402 clear_session=False, repo=repo_name)
402 clear_session=False, repo=repo_name)
403
403
404 self._assert_repo_name_passed(model_mock, repo_name)
404 self._assert_repo_name_passed(model_mock, repo_name)
@@ -407,7 +407,8 b' class TestConfigDataFromDb(object):'
407 ('section1', 'option1', 'value1'),
407 ('section1', 'option1', 'value1'),
408 ('section2', 'option2', 'value2'),
408 ('section2', 'option2', 'value2'),
409 ]
409 ]
410 assert result == expected_result
410 # We have extra config items returned, so we're ignoring two last items
411 assert result[:2] == expected_result
411
412
412 def _assert_repo_name_passed(self, model_mock, repo_name):
413 def _assert_repo_name_passed(self, model_mock, repo_name):
413 assert model_mock.call_count == 1
414 assert model_mock.call_count == 1
@@ -592,7 +592,6 b' class TestUpdateGlobalSslSetting(object)'
592 class TestCreateOrUpdateGlobalHgSettings(object):
592 class TestCreateOrUpdateGlobalHgSettings(object):
593 FORM_DATA = {
593 FORM_DATA = {
594 'extensions_largefiles': False,
594 'extensions_largefiles': False,
595 'largefiles_usercache': '/example/largefiles-store',
596 'phases_publish': False,
595 'phases_publish': False,
597 'extensions_evolve': False
596 'extensions_evolve': False
598 }
597 }
@@ -605,7 +604,6 b' class TestCreateOrUpdateGlobalHgSettings'
605
604
606 expected_calls = [
605 expected_calls = [
607 mock.call(model.global_settings, 'extensions', 'largefiles', active=False, value=''),
606 mock.call(model.global_settings, 'extensions', 'largefiles', active=False, value=''),
608 mock.call(model.global_settings, 'largefiles', 'usercache', value='/example/largefiles-store'),
609 mock.call(model.global_settings, 'phases', 'publish', value='False'),
607 mock.call(model.global_settings, 'phases', 'publish', value='False'),
610 mock.call(model.global_settings, 'extensions', 'evolve', active=False, value=''),
608 mock.call(model.global_settings, 'extensions', 'evolve', active=False, value=''),
611 mock.call(model.global_settings, 'experimental', 'evolution', active=False, value=''),
609 mock.call(model.global_settings, 'experimental', 'evolution', active=False, value=''),
@@ -632,7 +630,6 b' class TestCreateOrUpdateGlobalHgSettings'
632 class TestCreateOrUpdateGlobalGitSettings(object):
630 class TestCreateOrUpdateGlobalGitSettings(object):
633 FORM_DATA = {
631 FORM_DATA = {
634 'vcs_git_lfs_enabled': False,
632 'vcs_git_lfs_enabled': False,
635 'vcs_git_lfs_store_location': '/example/lfs-store',
636 }
633 }
637
634
638 def test_creates_repo_hg_settings_when_data_is_correct(self):
635 def test_creates_repo_hg_settings_when_data_is_correct(self):
@@ -643,7 +640,6 b' class TestCreateOrUpdateGlobalGitSetting'
643
640
644 expected_calls = [
641 expected_calls = [
645 mock.call(model.global_settings, 'vcs_git_lfs', 'enabled', active=False, value=False),
642 mock.call(model.global_settings, 'vcs_git_lfs', 'enabled', active=False, value=False),
646 mock.call(model.global_settings, 'vcs_git_lfs', 'store_location', value='/example/lfs-store'),
647 ]
643 ]
648 assert expected_calls == create_mock.call_args_list
644 assert expected_calls == create_mock.call_args_list
649
645
@@ -1001,9 +997,7 b' class TestCreateOrUpdateRepoSettings(obj'
1001 'hooks_outgoing_pull_logger': False,
997 'hooks_outgoing_pull_logger': False,
1002 'extensions_largefiles': False,
998 'extensions_largefiles': False,
1003 'extensions_evolve': False,
999 'extensions_evolve': False,
1004 'largefiles_usercache': '/example/largefiles-store',
1005 'vcs_git_lfs_enabled': False,
1000 'vcs_git_lfs_enabled': False,
1006 'vcs_git_lfs_store_location': '/',
1007 'phases_publish': 'False',
1001 'phases_publish': 'False',
1008 'rhodecode_pr_merge_enabled': False,
1002 'rhodecode_pr_merge_enabled': False,
1009 'rhodecode_use_outdated_comments': False,
1003 'rhodecode_use_outdated_comments': False,
General Comments 0
You need to be logged in to leave comments. Login now