Changeset - 2d49ab82003b
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-01-21 17:35:11
madski@unity3d.com
admin: when scanning for repos without 'remove', report the repos that could/would be removed
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/utils.py
Show inline comments
 
@@ -523,20 +523,20 @@ def repo2db_mapper(initial_repo_list, re
 
                ScmModel().install_git_hook(db_repo.scm_instance)
 

	
 
    removed = []
 
    if remove_obsolete:
 
        # remove from database those repositories that are not in the filesystem
 
        for repo in sa.query(Repository).all():
 
            if repo.repo_name not in initial_repo_list.keys():
 
    # remove from database those repositories that are not in the filesystem
 
    for repo in sa.query(Repository).all():
 
        if repo.repo_name not in initial_repo_list.keys():
 
            if remove_obsolete:
 
                log.debug("Removing non-existing repository found in db `%s`" %
 
                          repo.repo_name)
 
                try:
 
                    removed.append(repo.repo_name)
 
                    RepoModel(sa).delete(repo, forks='detach', fs_remove=False)
 
                    sa.commit()
 
                except Exception:
 
                    #don't hold further removals on error
 
                    log.error(traceback.format_exc())
 
                    sa.rollback()
 
            removed.append(repo.repo_name)
 
    return added, removed
 

	
 

	
0 comments (0 inline, 0 general)