##// END OF EJS Templates
feat(upgrade): added feature to bulk upgrade hooks from 4.X -> 5.X fixes RCCE-34
super-admin -
r5275:c32427b8 default
parent child Browse files
Show More
@@ -145,7 +145,7 b' dev-srv:'
145 145 .PHONY: dev-srv-g
146 146 ## run gunicorn multi process workers
147 147 dev-srv-g:
148 gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120
148 gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload
149 149
150 150
151 151 # Default command on calling make
@@ -206,7 +206,7 b' def rescan_repos(request, apiuser, remov'
206 206 try:
207 207 rm_obsolete = Optional.extract(remove_obsolete)
208 208 added, removed = repo2db_mapper(ScmModel().repo_scan(),
209 remove_obsolete=rm_obsolete)
209 remove_obsolete=rm_obsolete, force_hooks_rebuild=True)
210 210 return {'added': added, 'removed': removed}
211 211 except Exception:
212 212 log.exception('Failed to run repo rescann')
@@ -217,7 +217,7 b' class AdminSettingsView(BaseAppView):'
217 217 def settings_mapping(self):
218 218 c = self.load_default_context()
219 219 c.active = 'mapping'
220
220 c.storage_path = VcsSettingsModel().get_repos_location()
221 221 data = render('rhodecode:templates/admin/settings/settings.mako',
222 222 self._get_template_context(c), self.request)
223 223 html = formencode.htmlfill.render(
@@ -245,7 +245,7 b' class AdminSettingsView(BaseAppView):'
245 245 ScmModel().mark_for_invalidation(repo.repo_name, delete=True)
246 246
247 247 filesystem_repos = ScmModel().repo_scan()
248 added, removed = repo2db_mapper(filesystem_repos, rm_obsolete)
248 added, removed = repo2db_mapper(filesystem_repos, rm_obsolete, force_hooks_rebuild=True)
249 249 PermissionModel().trigger_permission_flush()
250 250
251 251 def _repr(rm_repo):
@@ -508,7 +508,7 b' def map_groups(path):'
508 508 return group
509 509
510 510
511 def repo2db_mapper(initial_repo_list, remove_obsolete=False):
511 def repo2db_mapper(initial_repo_list, remove_obsolete=False, force_hooks_rebuild=False):
512 512 """
513 513 maps all repos given in initial_repo_list, non existing repositories
514 514 are created, if remove_obsolete is True it also checks for db entries
@@ -537,9 +537,10 b' def repo2db_mapper(initial_repo_list, re'
537 537 group = map_groups(name)
538 538 str_name = safe_str(name)
539 539 db_repo = repo_model.get_by_repo_name(str_name)
540
540 541 # found repo that is on filesystem not in RhodeCode database
541 542 if not db_repo:
542 log.info('repository %s not found, creating now', name)
543 log.info('repository `%s` not found in the database, creating now', name)
543 544 added.append(name)
544 545 desc = (repo.description
545 546 if repo.description != 'unknown'
@@ -570,7 +571,7 b' def repo2db_mapper(initial_repo_list, re'
570 571 config = db_repo._config
571 572 config.set('extensions', 'largefiles', '')
572 573 repo = db_repo.scm_instance(config=config)
573 repo.install_hooks()
574 repo.install_hooks(force=force_hooks_rebuild)
574 575
575 576 removed = []
576 577 if remove_obsolete:
@@ -5,6 +5,11 b''
5 5 <h3 class="panel-title">${_('Import New Groups or Repositories')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8
9 <p>
10 ${_('This function will scann all data under the current storage path location at')} <code>${c.storage_path}</code>
11 </p>
12
8 13 <div class="checkbox">
9 14 ${h.checkbox('destroy',True)}
10 15 <label for="destroy">${_('Destroy old data')}</label>
@@ -358,7 +358,7 b' class TestRepoContainer(object):'
358 358 return Repository.get(self._repos[key])
359 359
360 360 def _create_repo(self, dump_name, backend_alias, config):
361 repo_name = '%s-%s' % (backend_alias, dump_name)
361 repo_name = f'{backend_alias}-{dump_name}'
362 362 backend = get_backend(backend_alias)
363 363 dump_extractor = self.dump_extractors[backend_alias]
364 364 repo_path = dump_extractor(dump_name, repo_name)
@@ -231,8 +231,6 b' def platform_encodes_filenames():'
231 231 return path_with_latin1 != read_path
232 232
233 233
234
235
236 234 def test_repo2db_mapper_groups(repo_groups):
237 235 session = meta.Session()
238 236 zombie_group, parent_group, child_group = repo_groups
General Comments 0
You need to be logged in to leave comments. Login now