##// 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 375 hgevolve.ui_active = False
376 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 399 # enable hggit disabled by default
379 400 hggit = RhodeCodeUi()
380 401 hggit.ui_section = 'extensions'
@@ -371,7 +371,8 b' def config_data_from_db(clear_session=Tr'
371 371 config.append((
372 372 safe_str(setting.section), safe_str(setting.key), False))
373 373 log.debug(
374 'settings ui from db: %s',
374 'settings ui from db@repo[%s]: %s',
375 repo,
375 376 ','.join(map(lambda s: '[{}] {}={}'.format(*s), ui_data)))
376 377 if clear_session:
377 378 meta.Session.remove()
@@ -119,6 +119,7 b' class SettingsModel(BaseModel):'
119 119 new_ui.ui_value = val
120 120 new_ui.ui_active = active
121 121
122 repository_id = ''
122 123 if self.repo:
123 124 repo = self._get_repo(self.repo)
124 125 repository_id = repo.repo_id
@@ -440,26 +441,37 b' class VcsSettingsModel(object):'
440 441 HOOKS_SETTINGS = (
441 442 ('hooks', 'changegroup.repo_size'),
442 443 ('hooks', 'changegroup.push_logger'),
443 ('hooks', 'outgoing.pull_logger'),)
444 ('hooks', 'outgoing.pull_logger'),
445 )
444 446 HG_SETTINGS = (
445 447 ('extensions', 'largefiles'),
446 448 ('phases', 'publish'),
447 ('extensions', 'evolve'),)
449 ('extensions', 'evolve'),
450 ('extensions', 'topic'),
451 ('experimental', 'evolution'),
452 )
448 453 GIT_SETTINGS = (
449 ('vcs_git_lfs', 'enabled'),)
454 ('vcs_git_lfs', 'enabled'),
455 )
450 456 GLOBAL_HG_SETTINGS = (
451 457 ('extensions', 'largefiles'),
452 458 ('largefiles', 'usercache'),
453 459 ('phases', 'publish'),
454 460 ('extensions', 'hgsubversion'),
455 ('extensions', 'evolve'),)
461 ('extensions', 'evolve'),
462 ('extensions', 'topic'),
463 ('experimental', 'evolution'),
464 )
465
456 466 GLOBAL_GIT_SETTINGS = (
457 467 ('vcs_git_lfs', 'enabled'),
458 ('vcs_git_lfs', 'store_location'))
468 ('vcs_git_lfs', 'store_location')
469 )
459 470
460 471 GLOBAL_SVN_SETTINGS = (
461 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 476 SVN_BRANCH_SECTION = 'vcs_svn_branch'
465 477 SVN_TAG_SECTION = 'vcs_svn_tag'
@@ -574,12 +586,38 b' class VcsSettingsModel(object):'
574 586 def create_repo_svn_settings(self, data):
575 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 615 @assert_repo_settings
578 616 def create_or_update_repo_hg_settings(self, data):
579 617 largefiles, phases, evolve = \
580 self.HG_SETTINGS
618 self.HG_SETTINGS[:3]
581 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 622 self._create_or_update_ui(
585 623 self.repo_settings, *largefiles, value='',
@@ -587,21 +625,22 b' class VcsSettingsModel(object):'
587 625 self._create_or_update_ui(
588 626 self.repo_settings, *evolve, value='',
589 627 active=data[evolve_key])
628 self._set_evolution(self.repo_settings, is_enabled=data[evolve_key])
629
590 630 self._create_or_update_ui(
591 631 self.repo_settings, *phases, value=safe_str(data[phases_key]))
592 632
593 633 def create_or_update_global_hg_settings(self, data):
594 634 largefiles, largefiles_store, phases, hgsubversion, evolve \
595 = self.GLOBAL_HG_SETTINGS
635 = self.GLOBAL_HG_SETTINGS[:5]
596 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 639 self._create_or_update_ui(
600 640 self.global_settings, *largefiles, value='',
601 641 active=data[largefiles_key])
602 642 self._create_or_update_ui(
603 self.global_settings, *largefiles_store,
604 value=data[largefiles_store_key])
643 self.global_settings, *largefiles_store, value=data[largefiles_store_key])
605 644 self._create_or_update_ui(
606 645 self.global_settings, *phases, value=safe_str(data[phases_key]))
607 646 self._create_or_update_ui(
@@ -609,9 +648,10 b' class VcsSettingsModel(object):'
609 648 self._create_or_update_ui(
610 649 self.global_settings, *evolve, value='',
611 650 active=data[evolve_key])
651 self._set_evolution(self.global_settings, is_enabled=data[evolve_key])
612 652
613 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 655 lfs_enabled, \
616 656 = self.GIT_SETTINGS
617 657
@@ -675,6 +715,7 b' class VcsSettingsModel(object):'
675 715 def get_repo_ui_settings(self, section=None, key=None):
676 716 global_uis = self.global_settings.get_ui(section, key)
677 717 repo_uis = self.repo_settings.get_ui(section, key)
718
678 719 filtered_repo_uis = self._filter_ui_settings(repo_uis)
679 720 filtered_repo_uis_keys = [
680 721 (s.section, s.key) for s in filtered_repo_uis]
@@ -133,13 +133,13 b''
133 133
134 134 <div class="checkbox">
135 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 137 </div>
138 138 <div class="label">
139 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 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 143 % endif
144 144 </div>
145 145
@@ -501,8 +501,8 b' class TestCreateOrUpdateUi(object):'
501 501
502 502 def test_update(self, repo_stub, settings_util):
503 503 model = VcsSettingsModel(repo=repo_stub.repo_name)
504
505 largefiles, phases, evolve = model.HG_SETTINGS
504 # care about only 3 first settings
505 largefiles, phases, evolve = model.HG_SETTINGS[:3]
506 506
507 507 section = 'test-section'
508 508 key = 'test-key'
@@ -531,10 +531,11 b' class TestCreateOrUpdateRepoHgSettings(o'
531 531 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
532 532 model.create_or_update_repo_hg_settings(self.FORM_DATA)
533 533 expected_calls = [
534 mock.call(model.repo_settings, 'extensions', 'largefiles',
535 active=False, value=''),
536 mock.call(model.repo_settings, 'extensions', 'evolve',
537 active=False, value=''),
534 mock.call(model.repo_settings, 'extensions', 'largefiles', active=False, value=''),
535 mock.call(model.repo_settings, 'extensions', 'evolve', active=False, value=''),
536 mock.call(model.repo_settings, 'experimental', 'evolution', 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 539 mock.call(model.repo_settings, 'phases', 'publish', value='False'),
539 540 ]
540 541 assert expected_calls == create_mock.call_args_list
@@ -589,17 +590,16 b' class TestCreateOrUpdateGlobalHgSettings'
589 590 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
590 591 model.create_or_update_global_hg_settings(self.FORM_DATA)
591 592 expected_calls = [
592 mock.call(model.global_settings, 'extensions', 'largefiles',
593 active=False, value=''),
594 mock.call(model.global_settings, 'largefiles', 'usercache',
595 value='/example/largefiles-store'),
596 mock.call(model.global_settings, 'phases', 'publish',
597 value='False'),
598 mock.call(model.global_settings, 'extensions', 'hgsubversion',
599 active=False),
600 mock.call(model.global_settings, 'extensions', 'evolve',
601 active=False, value='')
593 mock.call(model.global_settings, 'extensions', 'largefiles', active=False, value=''),
594 mock.call(model.global_settings, 'largefiles', 'usercache', value='/example/largefiles-store'),
595 mock.call(model.global_settings, 'phases', 'publish', value='False'),
596 mock.call(model.global_settings, 'extensions', 'hgsubversion', active=False),
597 mock.call(model.global_settings, 'extensions', 'evolve', active=False, value=''),
598 mock.call(model.global_settings, 'experimental', 'evolution', active=False, value=''),
599 mock.call(model.global_settings, 'experimental', 'evolution.exchange', active=False, value='no'),
600 mock.call(model.global_settings, 'extensions', 'topic', active=False, value=''),
602 601 ]
602
603 603 assert expected_calls == create_mock.call_args_list
604 604
605 605 @pytest.mark.parametrize('field_to_remove', FORM_DATA.keys())
@@ -625,10 +625,8 b' class TestCreateOrUpdateGlobalGitSetting'
625 625 with mock.patch.object(model, '_create_or_update_ui') as create_mock:
626 626 model.create_or_update_global_git_settings(self.FORM_DATA)
627 627 expected_calls = [
628 mock.call(model.global_settings, 'vcs_git_lfs', 'enabled',
629 active=False, value=False),
630 mock.call(model.global_settings, 'vcs_git_lfs', 'store_location',
631 value='/example/lfs-store'),
628 mock.call(model.global_settings, 'vcs_git_lfs', 'enabled', active=False, value=False),
629 mock.call(model.global_settings, 'vcs_git_lfs', 'store_location', value='/example/lfs-store'),
632 630 ]
633 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