changeset 4776:2d49ab82003b

admin: when scanning for repos without 'remove', report the repos that could/would be removed
author Mads Kiilerich <madski@unity3d.com>
date Wed, 21 Jan 2015 17:35:11 +0100
parents 787f30a1a996
children 18f932dc9001
files kallithea/lib/utils.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/utils.py	Wed Jan 21 17:35:11 2015 +0100
+++ b/kallithea/lib/utils.py	Wed Jan 21 17:35:11 2015 +0100
@@ -523,20 +523,20 @@
                 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