changeset 4718:b504198073b7

settings: set current user as owner when running repo scan
author Mads Kiilerich <madski@unity3d.com>
date Tue, 06 Jan 2015 00:54:35 +0100
parents db101282d91b
children 28f890cf7c4d
files kallithea/controllers/admin/settings.py kallithea/lib/utils.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/admin/settings.py	Tue Jan 06 00:54:35 2015 +0100
+++ b/kallithea/controllers/admin/settings.py	Tue Jan 06 00:54:35 2015 +0100
@@ -208,7 +208,8 @@
 
             filesystem_repos = ScmModel().repo_scan()
             added, removed = repo2db_mapper(filesystem_repos, rm_obsolete,
-                                            install_git_hook=install_git_hooks)
+                                            install_git_hook=install_git_hooks,
+                                            user=c.authuser.username)
             _repr = lambda l: ', '.join(map(safe_unicode, l)) or '-'
             h.flash(_('Repositories successfully '
                       'rescanned added: %s ; removed: %s') %
--- a/kallithea/lib/utils.py	Tue Jan 06 00:54:35 2015 +0100
+++ b/kallithea/lib/utils.py	Tue Jan 06 00:54:35 2015 +0100
@@ -471,7 +471,7 @@
 
 
 def repo2db_mapper(initial_repo_list, remove_obsolete=False,
-                   install_git_hook=False):
+                   install_git_hook=False, user=None):
     """
     maps all repos given in initial_repo_list, non existing repositories
     are created, if remove_obsolete is True it also check for db entries
@@ -486,7 +486,8 @@
     from kallithea.model.scm import ScmModel
     sa = meta.Session()
     repo_model = RepoModel()
-    user = User.get_first_admin()
+    if user is None:
+        user = User.get_first_admin()
     added = []
 
     ##creation defaults