Mercurial > kallithea
changeset 8775:8c781cb03412
repo-scan: log error and continue after failure creating a scanned repo
Continue after for example:
Exception: invalid repo name Foo
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 20 Nov 2020 16:10:30 +0100 |
parents | 5de682ee0b06 |
children | 92894fccc615 |
files | kallithea/lib/utils.py |
diffstat | 1 files changed, 16 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/utils.py Fri Nov 20 16:06:13 2020 +0100 +++ b/kallithea/lib/utils.py Fri Nov 20 16:10:30 2020 +0100 @@ -413,17 +413,22 @@ if repo.description != 'unknown' else '%s repository' % name) - new_repo = repo_model._create_repo( - repo_name=name, - repo_type=repo.alias, - description=desc, - repo_group=getattr(group, 'group_id', None), - owner=user, - enable_downloads=enable_downloads, - enable_statistics=enable_statistics, - private=private, - state=db.Repository.STATE_CREATED - ) + try: + new_repo = repo_model._create_repo( + repo_name=name, + repo_type=repo.alias, + description=desc, + repo_group=getattr(group, 'group_id', None), + owner=user, + enable_downloads=enable_downloads, + enable_statistics=enable_statistics, + private=private, + state=db.Repository.STATE_CREATED + ) + except Exception as e: + log.error('error creating %r: %s: %s', name, type(e).__name__, e) + sa.rollback() + continue sa.commit() # we added that repo just now, and make sure it has githook # installed, and updated server info