Changeset - f35ddb654668
[Not reviewed]
default
0 3 0
Søren Løvborg - 9 years ago 2016-09-15 13:57:47
sorenl@unity3d.com
repos: inline RepoModel.update_repoinfo

It had only two invocations, each triggering separate code paths, all
to do a simple loop.
3 files changed with 4 insertions and 9 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/db_manage.py
Show inline comments
 
@@ -359,13 +359,14 @@ class DbManage(object):
 
                Session().delete(p)
 
            fixed = True
 
            self.populate_default_permissions()
 
        return fixed
 

	
 
    def update_repo_info(self):
 
        RepoModel.update_repoinfo()
 
        for repo in Repository.query():
 
            repo.update_changeset_cache()
 

	
 
    def config_prompt(self, test_repo_path='', retries=3):
 
        _path = self.cli_args.get('repos_location')
 
        if retries == 3:
 
            log.info('Setting up repositories config')
 

	
kallithea/lib/paster_commands/update_repoinfo.py
Show inline comments
 
@@ -57,13 +57,14 @@ class Command(BasePasterCommand):
 
            repo_list = Repository.query().all()
 
        else:
 
            repo_names = [safe_unicode(n.strip())
 
                          for n in self.options.repo_update_list.split(',')]
 
            repo_list = list(Repository.query()
 
                .filter(Repository.repo_name.in_(repo_names)))
 
        RepoModel.update_repoinfo(repositories=repo_list)
 
        for repo in repo_list:
 
            repo.update_changeset_cache()
 
        Session().commit()
 

	
 
        if self.options.invalidate_cache:
 
            for r in repo_list:
 
                r.set_invalidate()
 
            print 'Updated repo info and invalidated cache for %s repositories' % (len(repo_list))
kallithea/model/repo.py
Show inline comments
 
@@ -173,19 +173,12 @@ class RepoModel(BaseModel):
 
        template = _tmpl_lookup.get_template('data_table/_dt_elements.html')
 

	
 
        tmpl = template.get_def(tmpl)
 
        kwargs.update(dict(_=_, h=h, c=c))
 
        return tmpl.render(*args, **kwargs)
 

	
 
    @classmethod
 
    def update_repoinfo(cls, repositories=None):
 
        if repositories is None:
 
            repositories = Repository.query()
 
        for repo in repositories:
 
            repo.update_changeset_cache()
 

	
 
    def get_repos_as_dict(self, repos_list=None, admin=False, perm_check=True,
 
                          super_user_actions=False, short_name=False):
 
        _render = self._render_datatable
 
        from pylons import tmpl_context as c
 

	
 
        def quick_menu(repo_name):
0 comments (0 inline, 0 general)