Show More
@@ -467,9 +467,9 b' def repo2db_mapper(initial_repo_list, re' | |||||
467 | log.debug("Removing non-existing repository found in db `%s`" % |
|
467 | log.debug("Removing non-existing repository found in db `%s`" % | |
468 | repo.repo_name) |
|
468 | repo.repo_name) | |
469 | try: |
|
469 | try: | |
470 |
|
|
470 | removed.append(repo.repo_name) | |
|
471 | RepoModel(sa).delete(repo, forks='detach', fs_remove=False) | |||
471 | sa.commit() |
|
472 | sa.commit() | |
472 | removed.append(repo.repo_name) |
|
|||
473 | except Exception: |
|
473 | except Exception: | |
474 | #don't hold further removals on error |
|
474 | #don't hold further removals on error | |
475 | log.error(traceback.format_exc()) |
|
475 | log.error(traceback.format_exc()) |
@@ -466,7 +466,7 b' class RepoModel(BaseModel):' | |||||
466 | from rhodecode.lib.celerylib import tasks, run_task |
|
466 | from rhodecode.lib.celerylib import tasks, run_task | |
467 | run_task(tasks.create_repo_fork, form_data, cur_user) |
|
467 | run_task(tasks.create_repo_fork, form_data, cur_user) | |
468 |
|
468 | |||
469 | def delete(self, repo, forks=None): |
|
469 | def delete(self, repo, forks=None, fs_remove=True): | |
470 | """ |
|
470 | """ | |
471 | Delete given repository, forks parameter defines what do do with |
|
471 | Delete given repository, forks parameter defines what do do with | |
472 | attached forks. Throws AttachedForksError if deleted repo has attached |
|
472 | attached forks. Throws AttachedForksError if deleted repo has attached | |
@@ -474,6 +474,7 b' class RepoModel(BaseModel):' | |||||
474 |
|
474 | |||
475 | :param repo: |
|
475 | :param repo: | |
476 | :param forks: str 'delete' or 'detach' |
|
476 | :param forks: str 'delete' or 'detach' | |
|
477 | :param fs_remove: remove(archive) repo from filesystem | |||
477 | """ |
|
478 | """ | |
478 | repo = self._get_repo(repo) |
|
479 | repo = self._get_repo(repo) | |
479 | if repo: |
|
480 | if repo: | |
@@ -491,7 +492,10 b' class RepoModel(BaseModel):' | |||||
491 | owner = repo.user |
|
492 | owner = repo.user | |
492 | try: |
|
493 | try: | |
493 | self.sa.delete(repo) |
|
494 | self.sa.delete(repo) | |
494 |
|
|
495 | if fs_remove: | |
|
496 | self.__delete_repo(repo) | |||
|
497 | else: | |||
|
498 | log.debug('skipping removal from filesystem') | |||
495 | log_delete_repository(old_repo_dict, |
|
499 | log_delete_repository(old_repo_dict, | |
496 | deleted_by=owner.username) |
|
500 | deleted_by=owner.username) | |
497 | except Exception: |
|
501 | except Exception: |
General Comments 0
You need to be logged in to leave comments.
Login now