##// 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 689 ; It uses cache_region `cache_repo`
690 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 699 ; Subversion proxy support (mod_dav_svn)
694 700 ; Maps RhodeCode repo groups into SVN paths for Apache
@@ -657,6 +657,12 b' vcs.connection_timeout = 3600'
657 657 ; It uses cache_region `cache_repo`
658 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 667 ; Subversion proxy support (mod_dav_svn)
662 668 ; Maps RhodeCode repo groups into SVN paths for Apache
@@ -116,6 +116,9 b' def sanitize_settings_and_apply_defaults'
116 116 settings_maker.make_setting('vcs.start_server', 'false', parser='bool')
117 117 settings_maker.make_setting('vcs.backends', 'hg, git, svn', parser='list')
118 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 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 43 from mako import exceptions
44 44
45 from rhodecode import ConfigGet
45 46 from rhodecode.lib.hash_utils import sha256_safe, md5, sha1
46 47 from rhodecode.lib.type_utils import AttributeDict
47 48 from rhodecode.lib.str_utils import safe_bytes, safe_str
@@ -364,9 +365,9 b' ui_sections = ['
364 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 371 tuples.
371 372 """
372 373 from rhodecode.model.settings import VcsSettingsModel
@@ -380,6 +381,10 b' def config_data_from_db(clear_session=Tr'
380 381
381 382 ui_data = []
382 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 388 if setting.active:
384 389 ui_data.append((setting.section, setting.key, setting.value))
385 390 config.append((
@@ -390,6 +395,9 b' def config_data_from_db(clear_session=Tr'
390 395 # handles that
391 396 config.append((
392 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 401 log.debug(
394 402 'settings ui from db@repo[%s]: %s',
395 403 repo,
@@ -418,7 +426,7 b' def make_db_config(clear_session=True, r'
418 426 Create a :class:`Config` instance based on the values in the database.
419 427 """
420 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 430 for section, option, value in config_data:
423 431 config.set(section, option, value)
424 432 return config
@@ -469,12 +469,6 b' def ApplicationUiSettingsForm(localizer)'
469 469
470 470 class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
471 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 472 extensions_hggit = v.StringBoolean(if_missing=False)
479 473 new_svn_branch = v.ValidSvnPattern(localizer, section='vcs_svn_branch')
480 474 new_svn_tag = v.ValidSvnPattern(localizer, section='vcs_svn_tag')
@@ -486,7 +486,6 b' class VcsSettingsModel(object):'
486 486 )
487 487 GLOBAL_HG_SETTINGS = (
488 488 ('extensions', 'largefiles'),
489 ('largefiles', 'usercache'),
490 489 ('phases', 'publish'),
491 490 ('extensions', 'evolve'),
492 491 ('extensions', 'topic'),
@@ -496,7 +495,6 b' class VcsSettingsModel(object):'
496 495
497 496 GLOBAL_GIT_SETTINGS = (
498 497 ('vcs_git_lfs', 'enabled'),
499 ('vcs_git_lfs', 'store_location')
500 498 )
501 499
502 500 SVN_BRANCH_SECTION = 'vcs_svn_branch'
@@ -666,18 +664,16 b' class VcsSettingsModel(object):'
666 664 self.repo_settings, *phases, value=safe_str(data[phases_key]))
667 665
668 666 def create_or_update_global_hg_settings(self, data):
669 opts_len = 4
670 largefiles, largefiles_store, phases, evolve \
667 opts_len = 3
668 largefiles, phases, evolve \
671 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 671 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS[:opts_len], data)
674 672
675 673 self._create_or_update_ui(
676 674 self.global_settings, *largefiles, value='',
677 675 active=data[largefiles_key])
678 676 self._create_or_update_ui(
679 self.global_settings, *largefiles_store, value=data[largefiles_store_key])
680 self._create_or_update_ui(
681 677 self.global_settings, *phases, value=safe_str(data[phases_key]))
682 678 self._create_or_update_ui(
683 679 self.global_settings, *evolve, value='',
@@ -697,17 +693,12 b' class VcsSettingsModel(object):'
697 693 active=data[lfs_enabled_key])
698 694
699 695 def create_or_update_global_git_settings(self, data):
700 lfs_enabled, lfs_store_location \
701 = self.GLOBAL_GIT_SETTINGS
702 lfs_enabled_key, lfs_store_location_key \
703 = self._get_settings_keys(self.GLOBAL_GIT_SETTINGS, data)
696 lfs_enabled = self.GLOBAL_GIT_SETTINGS[0]
697 lfs_enabled_key = self._get_settings_keys(self.GLOBAL_GIT_SETTINGS, data)[0]
704 698
705 699 self._create_or_update_ui(
706 700 self.global_settings, *lfs_enabled, value=data[lfs_enabled_key],
707 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 703 def create_or_update_global_svn_settings(self, data):
713 704 # branch/tags patterns
@@ -75,17 +75,6 b''
75 75 % endif
76 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 78 <div class="checkbox">
90 79 ${h.checkbox('phases_publish' + suffix, 'True', **kwargs)}
91 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 116 <span class="help-block">${_('Enable lfs extensions for this repository.')}</span>
128 117 % endif
129 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 119 </div>
142 120 </div>
143 121 % endif
@@ -371,7 +371,7 b' class TestMakeDbConfig(object):'
371 371 ('section2', 'option2', 'value2'),
372 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 375 config_mock.return_value = test_data
376 376 kwargs = {'clear_session': False, 'repo': 'test_repo'}
377 377 result = utils.make_db_config(**kwargs)
@@ -381,8 +381,8 b' class TestMakeDbConfig(object):'
381 381 assert value == expected_value
382 382
383 383
384 class TestConfigDataFromDb(object):
385 def test_config_data_from_db_returns_active_settings(self):
384 class TestPrepareConfigData(object):
385 def test_prepare_config_data_returns_active_settings(self):
386 386 test_data = [
387 387 UiSetting('section1', 'option1', 'value1', True),
388 388 UiSetting('section2', 'option2', 'value2', True),
@@ -398,7 +398,7 b' class TestConfigDataFromDb(object):'
398 398 instance_mock = mock.Mock()
399 399 model_mock.return_value = instance_mock
400 400 instance_mock.get_ui_settings.return_value = test_data
401 result = utils.config_data_from_db(
401 result = utils.prepare_config_data(
402 402 clear_session=False, repo=repo_name)
403 403
404 404 self._assert_repo_name_passed(model_mock, repo_name)
@@ -407,7 +407,8 b' class TestConfigDataFromDb(object):'
407 407 ('section1', 'option1', 'value1'),
408 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 413 def _assert_repo_name_passed(self, model_mock, repo_name):
413 414 assert model_mock.call_count == 1
@@ -592,7 +592,6 b' class TestUpdateGlobalSslSetting(object)'
592 592 class TestCreateOrUpdateGlobalHgSettings(object):
593 593 FORM_DATA = {
594 594 'extensions_largefiles': False,
595 'largefiles_usercache': '/example/largefiles-store',
596 595 'phases_publish': False,
597 596 'extensions_evolve': False
598 597 }
@@ -605,7 +604,6 b' class TestCreateOrUpdateGlobalHgSettings'
605 604
606 605 expected_calls = [
607 606 mock.call(model.global_settings, 'extensions', 'largefiles', active=False, value=''),
608 mock.call(model.global_settings, 'largefiles', 'usercache', value='/example/largefiles-store'),
609 607 mock.call(model.global_settings, 'phases', 'publish', value='False'),
610 608 mock.call(model.global_settings, 'extensions', 'evolve', active=False, value=''),
611 609 mock.call(model.global_settings, 'experimental', 'evolution', active=False, value=''),
@@ -632,7 +630,6 b' class TestCreateOrUpdateGlobalHgSettings'
632 630 class TestCreateOrUpdateGlobalGitSettings(object):
633 631 FORM_DATA = {
634 632 'vcs_git_lfs_enabled': False,
635 'vcs_git_lfs_store_location': '/example/lfs-store',
636 633 }
637 634
638 635 def test_creates_repo_hg_settings_when_data_is_correct(self):
@@ -643,7 +640,6 b' class TestCreateOrUpdateGlobalGitSetting'
643 640
644 641 expected_calls = [
645 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 644 assert expected_calls == create_mock.call_args_list
649 645
@@ -1001,9 +997,7 b' class TestCreateOrUpdateRepoSettings(obj'
1001 997 'hooks_outgoing_pull_logger': False,
1002 998 'extensions_largefiles': False,
1003 999 'extensions_evolve': False,
1004 'largefiles_usercache': '/example/largefiles-store',
1005 1000 'vcs_git_lfs_enabled': False,
1006 'vcs_git_lfs_store_location': '/',
1007 1001 'phases_publish': 'False',
1008 1002 'rhodecode_pr_merge_enabled': False,
1009 1003 'rhodecode_use_outdated_comments': False,
General Comments 0
You need to be logged in to leave comments. Login now