##// END OF EJS Templates
mercurial: enabled full evolve+topic extensions
marcink -
r3625:4c188069 default
parent child Browse files
Show More
@@ -375,6 +375,27 b' class DbManage(object):'
375 hgevolve.ui_active = False
375 hgevolve.ui_active = False
376 self.sa.add(hgevolve)
376 self.sa.add(hgevolve)
377
377
378 hgevolve = RhodeCodeUi()
379 hgevolve.ui_section = 'experimental'
380 hgevolve.ui_key = 'evolution'
381 hgevolve.ui_value = ''
382 hgevolve.ui_active = False
383 self.sa.add(hgevolve)
384
385 hgevolve = RhodeCodeUi()
386 hgevolve.ui_section = 'experimental'
387 hgevolve.ui_key = 'evolution.exchange'
388 hgevolve.ui_value = ''
389 hgevolve.ui_active = False
390 self.sa.add(hgevolve)
391
392 hgevolve = RhodeCodeUi()
393 hgevolve.ui_section = 'extensions'
394 hgevolve.ui_key = 'topic'
395 hgevolve.ui_value = ''
396 hgevolve.ui_active = False
397 self.sa.add(hgevolve)
398
378 # enable hggit disabled by default
399 # enable hggit disabled by default
379 hggit = RhodeCodeUi()
400 hggit = RhodeCodeUi()
380 hggit.ui_section = 'extensions'
401 hggit.ui_section = 'extensions'
@@ -371,7 +371,8 b' def config_data_from_db(clear_session=Tr'
371 config.append((
371 config.append((
372 safe_str(setting.section), safe_str(setting.key), False))
372 safe_str(setting.section), safe_str(setting.key), False))
373 log.debug(
373 log.debug(
374 'settings ui from db: %s',
374 'settings ui from db@repo[%s]: %s',
375 repo,
375 ','.join(map(lambda s: '[{}] {}={}'.format(*s), ui_data)))
376 ','.join(map(lambda s: '[{}] {}={}'.format(*s), ui_data)))
376 if clear_session:
377 if clear_session:
377 meta.Session.remove()
378 meta.Session.remove()
@@ -119,6 +119,7 b' class SettingsModel(BaseModel):'
119 new_ui.ui_value = val
119 new_ui.ui_value = val
120 new_ui.ui_active = active
120 new_ui.ui_active = active
121
121
122 repository_id = ''
122 if self.repo:
123 if self.repo:
123 repo = self._get_repo(self.repo)
124 repo = self._get_repo(self.repo)
124 repository_id = repo.repo_id
125 repository_id = repo.repo_id
@@ -440,26 +441,37 b' class VcsSettingsModel(object):'
440 HOOKS_SETTINGS = (
441 HOOKS_SETTINGS = (
441 ('hooks', 'changegroup.repo_size'),
442 ('hooks', 'changegroup.repo_size'),
442 ('hooks', 'changegroup.push_logger'),
443 ('hooks', 'changegroup.push_logger'),
443 ('hooks', 'outgoing.pull_logger'),)
444 ('hooks', 'outgoing.pull_logger'),
445 )
444 HG_SETTINGS = (
446 HG_SETTINGS = (
445 ('extensions', 'largefiles'),
447 ('extensions', 'largefiles'),
446 ('phases', 'publish'),
448 ('phases', 'publish'),
447 ('extensions', 'evolve'),)
449 ('extensions', 'evolve'),
450 ('extensions', 'topic'),
451 ('experimental', 'evolution'),
452 )
448 GIT_SETTINGS = (
453 GIT_SETTINGS = (
449 ('vcs_git_lfs', 'enabled'),)
454 ('vcs_git_lfs', 'enabled'),
455 )
450 GLOBAL_HG_SETTINGS = (
456 GLOBAL_HG_SETTINGS = (
451 ('extensions', 'largefiles'),
457 ('extensions', 'largefiles'),
452 ('largefiles', 'usercache'),
458 ('largefiles', 'usercache'),
453 ('phases', 'publish'),
459 ('phases', 'publish'),
454 ('extensions', 'hgsubversion'),
460 ('extensions', 'hgsubversion'),
455 ('extensions', 'evolve'),)
461 ('extensions', 'evolve'),
462 ('extensions', 'topic'),
463 ('experimental', 'evolution'),
464 )
465
456 GLOBAL_GIT_SETTINGS = (
466 GLOBAL_GIT_SETTINGS = (
457 ('vcs_git_lfs', 'enabled'),
467 ('vcs_git_lfs', 'enabled'),
458 ('vcs_git_lfs', 'store_location'))
468 ('vcs_git_lfs', 'store_location')
469 )
459
470
460 GLOBAL_SVN_SETTINGS = (
471 GLOBAL_SVN_SETTINGS = (
461 ('vcs_svn_proxy', 'http_requests_enabled'),
472 ('vcs_svn_proxy', 'http_requests_enabled'),
462 ('vcs_svn_proxy', 'http_server_url'))
473 ('vcs_svn_proxy', 'http_server_url')
474 )
463
475
464 SVN_BRANCH_SECTION = 'vcs_svn_branch'
476 SVN_BRANCH_SECTION = 'vcs_svn_branch'
465 SVN_TAG_SECTION = 'vcs_svn_tag'
477 SVN_TAG_SECTION = 'vcs_svn_tag'
@@ -574,12 +586,38 b' class VcsSettingsModel(object):'
574 def create_repo_svn_settings(self, data):
586 def create_repo_svn_settings(self, data):
575 return self._create_svn_settings(self.repo_settings, data)
587 return self._create_svn_settings(self.repo_settings, data)
576
588
589 def _set_evolution(self, settings, is_enabled):
590 if is_enabled:
591 # if evolve is active set evolution=all
592
593 self._create_or_update_ui(
594 settings, *('experimental', 'evolution'), value='all',
595 active=True)
596 self._create_or_update_ui(
597 settings, *('experimental', 'evolution.exchange'), value='yes',
598 active=True)
599 # if evolve is active set topics server support
600 self._create_or_update_ui(
601 settings, *('extensions', 'topic'), value='',
602 active=True)
603
604 else:
605 self._create_or_update_ui(
606 settings, *('experimental', 'evolution'), value='',
607 active=False)
608 self._create_or_update_ui(
609 settings, *('experimental', 'evolution.exchange'), value='no',
610 active=False)
611 self._create_or_update_ui(
612 settings, *('extensions', 'topic'), value='',
613 active=False)
614
577 @assert_repo_settings
615 @assert_repo_settings
578 def create_or_update_repo_hg_settings(self, data):
616 def create_or_update_repo_hg_settings(self, data):
579 largefiles, phases, evolve = \
617 largefiles, phases, evolve = \
580 self.HG_SETTINGS
618 self.HG_SETTINGS[:3]
581 largefiles_key, phases_key, evolve_key = \
619 largefiles_key, phases_key, evolve_key = \
582 self._get_settings_keys(self.HG_SETTINGS, data)
620 self._get_settings_keys(self.HG_SETTINGS[:3], data)
583
621
584 self._create_or_update_ui(
622 self._create_or_update_ui(
585 self.repo_settings, *largefiles, value='',
623 self.repo_settings, *largefiles, value='',
@@ -587,21 +625,22 b' class VcsSettingsModel(object):'
587 self._create_or_update_ui(
625 self._create_or_update_ui(
588 self.repo_settings, *evolve, value='',
626 self.repo_settings, *evolve, value='',
589 active=data[evolve_key])
627 active=data[evolve_key])
628 self._set_evolution(self.repo_settings, is_enabled=data[evolve_key])
629
590 self._create_or_update_ui(
630 self._create_or_update_ui(
591 self.repo_settings, *phases, value=safe_str(data[phases_key]))
631 self.repo_settings, *phases, value=safe_str(data[phases_key]))
592
632
593 def create_or_update_global_hg_settings(self, data):
633 def create_or_update_global_hg_settings(self, data):
594 largefiles, largefiles_store, phases, hgsubversion, evolve \
634 largefiles, largefiles_store, phases, hgsubversion, evolve \
595 = self.GLOBAL_HG_SETTINGS
635 = self.GLOBAL_HG_SETTINGS[:5]
596 largefiles_key, largefiles_store_key, phases_key, subversion_key, evolve_key \
636 largefiles_key, largefiles_store_key, phases_key, subversion_key, evolve_key \
597 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data)
637 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS[:5], data)
598
638
599 self._create_or_update_ui(
639 self._create_or_update_ui(
600 self.global_settings, *largefiles, value='',
640 self.global_settings, *largefiles, value='',
601 active=data[largefiles_key])
641 active=data[largefiles_key])
602 self._create_or_update_ui(
642 self._create_or_update_ui(
603 self.global_settings, *largefiles_store,
643 self.global_settings, *largefiles_store, value=data[largefiles_store_key])
604 value=data[largefiles_store_key])
605 self._create_or_update_ui(
644 self._create_or_update_ui(
606 self.global_settings, *phases, value=safe_str(data[phases_key]))
645 self.global_settings, *phases, value=safe_str(data[phases_key]))
607 self._create_or_update_ui(
646 self._create_or_update_ui(
@@ -609,9 +648,10 b' class VcsSettingsModel(object):'
609 self._create_or_update_ui(
648 self._create_or_update_ui(
610 self.global_settings, *evolve, value='',
649 self.global_settings, *evolve, value='',
611 active=data[evolve_key])
650 active=data[evolve_key])
651 self._set_evolution(self.global_settings, is_enabled=data[evolve_key])
612
652
613 def create_or_update_repo_git_settings(self, data):
653 def create_or_update_repo_git_settings(self, data):
614 # NOTE(marcink): # comma make unpack work properly
654 # NOTE(marcink): # comma makes unpack work properly
615 lfs_enabled, \
655 lfs_enabled, \
616 = self.GIT_SETTINGS
656 = self.GIT_SETTINGS
617
657
@@ -675,6 +715,7 b' class VcsSettingsModel(object):'
675 def get_repo_ui_settings(self, section=None, key=None):
715 def get_repo_ui_settings(self, section=None, key=None):
676 global_uis = self.global_settings.get_ui(section, key)
716 global_uis = self.global_settings.get_ui(section, key)
677 repo_uis = self.repo_settings.get_ui(section, key)
717 repo_uis = self.repo_settings.get_ui(section, key)
718
678 filtered_repo_uis = self._filter_ui_settings(repo_uis)
719 filtered_repo_uis = self._filter_ui_settings(repo_uis)
679 filtered_repo_uis_keys = [
720 filtered_repo_uis_keys = [
680 (s.section, s.key) for s in filtered_repo_uis]
721 (s.section, s.key) for s in filtered_repo_uis]
@@ -133,13 +133,13 b''
133
133
134 <div class="checkbox">
134 <div class="checkbox">
135 ${h.checkbox('extensions_evolve' + suffix, 'True', **kwargs)}
135 ${h.checkbox('extensions_evolve' + suffix, 'True', **kwargs)}
136 <label for="extensions_evolve${suffix}">${_('Enable evolve extension')}</label>
136 <label for="extensions_evolve${suffix}">${_('Enable Evolve and Topic extension')}</label>
137 </div>
137 </div>
138 <div class="label">
138 <div class="label">
139 % if display_globals:
139 % if display_globals:
140 <span class="help-block">${_('Enable evolve extension for all repositories.')}</span>
140 <span class="help-block">${_('Enable Evolve and Topic extensions for all repositories.')}</span>
141 % else:
141 % else:
142 <span class="help-block">${_('Enable evolve extension for this repository.')}</span>
142 <span class="help-block">${_('Enable Evolve and Topic extensions for this repository.')}</span>
143 % endif
143 % endif
144 </div>
144 </div>
145
145
@@ -501,8 +501,8 b' class TestCreateOrUpdateUi(object):'
501
501
502 def test_update(self, repo_stub, settings_util):
502 def test_update(self, repo_stub, settings_util):
503 model = VcsSettingsModel(repo=repo_stub.repo_name)
503 model = VcsSettingsModel(repo=repo_stub.repo_name)
504
504 # care about only 3 first settings
505 largefiles, phases, evolve = model.HG_SETTINGS
505 largefiles, phases, evolve = model.HG_SETTINGS[:3]
506
506
507 section = 'test-section'
507 section = 'test-section'
508 key = 'test-key'
508 key = 'test-key'
@@ -531,10 +531,11 b' class TestCreateOrUpdateRepoHgSettings(o'
531 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
531 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
532 model.create_or_update_repo_hg_settings(self.FORM_DATA)
532 model.create_or_update_repo_hg_settings(self.FORM_DATA)
533 expected_calls = [
533 expected_calls = [
534 mock.call(model.repo_settings, 'extensions', 'largefiles',
534 mock.call(model.repo_settings, 'extensions', 'largefiles', active=False, value=''),
535 active=False, value=''),
535 mock.call(model.repo_settings, 'extensions', 'evolve', active=False, value=''),
536 mock.call(model.repo_settings, 'extensions', 'evolve',
536 mock.call(model.repo_settings, 'experimental', 'evolution', active=False, value=''),
537 active=False, value=''),
537 mock.call(model.repo_settings, 'experimental', 'evolution.exchange', active=False, value='no'),
538 mock.call(model.repo_settings, 'extensions', 'topic', active=False, value=''),
538 mock.call(model.repo_settings, 'phases', 'publish', value='False'),
539 mock.call(model.repo_settings, 'phases', 'publish', value='False'),
539 ]
540 ]
540 assert expected_calls == create_mock.call_args_list
541 assert expected_calls == create_mock.call_args_list
@@ -589,17 +590,16 b' class TestCreateOrUpdateGlobalHgSettings'
589 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
590 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
590 model.create_or_update_global_hg_settings(self.FORM_DATA)
591 model.create_or_update_global_hg_settings(self.FORM_DATA)
591 expected_calls = [
592 expected_calls = [
592 mock.call(model.global_settings, 'extensions', 'largefiles',
593 mock.call(model.global_settings, 'extensions', 'largefiles', active=False, value=''),
593 active=False, value=''),
594 mock.call(model.global_settings, 'largefiles', 'usercache', value='/example/largefiles-store'),
594 mock.call(model.global_settings, 'largefiles', 'usercache',
595 mock.call(model.global_settings, 'phases', 'publish', value='False'),
595 value='/example/largefiles-store'),
596 mock.call(model.global_settings, 'extensions', 'hgsubversion', active=False),
596 mock.call(model.global_settings, 'phases', 'publish',
597 mock.call(model.global_settings, 'extensions', 'evolve', active=False, value=''),
597 value='False'),
598 mock.call(model.global_settings, 'experimental', 'evolution', active=False, value=''),
598 mock.call(model.global_settings, 'extensions', 'hgsubversion',
599 mock.call(model.global_settings, 'experimental', 'evolution.exchange', active=False, value='no'),
599 active=False),
600 mock.call(model.global_settings, 'extensions', 'topic', active=False, value=''),
600 mock.call(model.global_settings, 'extensions', 'evolve',
601 active=False, value='')
602 ]
601 ]
602
603 assert expected_calls == create_mock.call_args_list
603 assert expected_calls == create_mock.call_args_list
604
604
605 @pytest.mark.parametrize('field_to_remove', FORM_DATA.keys())
605 @pytest.mark.parametrize('field_to_remove', FORM_DATA.keys())
@@ -625,10 +625,8 b' class TestCreateOrUpdateGlobalGitSetting'
625 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
625 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
626 model.create_or_update_global_git_settings(self.FORM_DATA)
626 model.create_or_update_global_git_settings(self.FORM_DATA)
627 expected_calls = [
627 expected_calls = [
628 mock.call(model.global_settings, 'vcs_git_lfs', 'enabled',
628 mock.call(model.global_settings, 'vcs_git_lfs', 'enabled', active=False, value=False),
629 active=False, value=False),
629 mock.call(model.global_settings, 'vcs_git_lfs', 'store_location', value='/example/lfs-store'),
630 mock.call(model.global_settings, 'vcs_git_lfs', 'store_location',
631 value='/example/lfs-store'),
632 ]
630 ]
633 assert expected_calls == create_mock.call_args_list
631 assert expected_calls == create_mock.call_args_list
634
632
General Comments 0
You need to be logged in to leave comments. Login now