changeset 8066:d9d03f138cc3

lib: clarify that repo2db_mapper actually takes a dict
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 26 Dec 2019 11:52:58 +0100
parents 0bbf505c804f
children 85e34d874a1e
files kallithea/lib/utils.py kallithea/model/scm.py
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/utils.py	Sun Dec 22 21:43:54 2019 +0100
+++ b/kallithea/lib/utils.py	Thu Dec 26 11:52:58 2019 +0100
@@ -451,14 +451,14 @@
     return group
 
 
-def repo2db_mapper(initial_repo_list, remove_obsolete=False,
+def repo2db_mapper(initial_repo_dict, remove_obsolete=False,
                    install_git_hooks=False, user=None, overwrite_git_hooks=False):
     """
-    maps all repos given in initial_repo_list, non existing repositories
+    maps all repos given in initial_repo_dict, non existing repositories
     are created, if remove_obsolete is True it also check for db entries
-    that are not in initial_repo_list and removes them.
+    that are not in initial_repo_dict and removes them.
 
-    :param initial_repo_list: list of repositories found by scanning methods
+    :param initial_repo_dict: mapping with repositories found by scanning methods
     :param remove_obsolete: check for obsolete entries in database
     :param install_git_hooks: if this is True, also check and install git hook
         for a repo if missing
@@ -479,7 +479,7 @@
     enable_downloads = defs.get('repo_enable_downloads')
     private = defs.get('repo_private')
 
-    for name, repo in initial_repo_list.items():
+    for name, repo in initial_repo_dict.items():
         group = map_groups(name)
         unicode_name = safe_unicode(name)
         db_repo = repo_model.get_by_repo_name(unicode_name)
@@ -518,9 +518,9 @@
 
     removed = []
     # remove from database those repositories that are not in the filesystem
-    unicode_initial_repo_list = set(safe_unicode(name) for name in initial_repo_list)
+    unicode_initial_repo_names = set(safe_unicode(name) for name in initial_repo_dict)
     for repo in sa.query(Repository).all():
-        if repo.repo_name not in unicode_initial_repo_list:
+        if repo.repo_name not in unicode_initial_repo_names:
             if remove_obsolete:
                 log.debug("Removing non-existing repository found in db `%s`",
                           repo.repo_name)
--- a/kallithea/model/scm.py	Sun Dec 22 21:43:54 2019 +0100
+++ b/kallithea/model/scm.py	Thu Dec 26 11:52:58 2019 +0100
@@ -162,7 +162,8 @@
     def repo_scan(self, repos_path=None):
         """
         Listing of repositories in given path. This path should not be a
-        repository itself. Return a dictionary of repository objects
+        repository itself. Return a dictionary of repository objects mapping to
+        vcs instances.
 
         :param repos_path: path to directory containing repositories
         """