Changeset - 93795b901b32
[Not reviewed]
beta
0 1 0
Mads Kiilerich - 13 years ago 2013-04-03 15:56:12
madski@unity3d.com
update_repoinfo: fix invalidation
1 file changed with 1 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/paster_commands/update_repoinfo.py
Show inline comments
 
@@ -50,39 +50,38 @@ class Command(BasePasterCommand):
 
    usage = "CONFIG_FILE"
 
    group_name = "RhodeCode"
 
    takes_config_file = -1
 
    parser = BasePasterCommand.standard_parser(verbose=True)
 
    summary = "Updates repositories caches for last changeset"
 

	
 
    def command(self):
 
        #get SqlAlchemy session
 
        self._init_session()
 

	
 
        repo_update_list = map(string.strip,
 
                               self.options.repo_update_list.split(',')) \
 
                               if self.options.repo_update_list else None
 

	
 
        if repo_update_list:
 
            repo_list = Repository.query()\
 
                .filter(Repository.repo_name.in_(repo_update_list))
 
        else:
 
            repo_list = Repository.getAll()
 
        RepoModel.update_repoinfo(repositories=repo_list)
 
        Session().commit()
 

	
 
        if self.options.invalidate_cache:
 
            for r in repo_list:
 
                r.invalidate
 
        Session().commit()
 
                r.set_invalidate()
 
        log.info('Updated cache for %s repositories' % (len(repo_list)))
 

	
 
    def update_parser(self):
 
        self.parser.add_option('--update-only',
 
                           action='store',
 
                           dest='repo_update_list',
 
                           help="Specifies a comma separated list of repositores "
 
                                "to update last commit info for. OPTIONAL")
 
        self.parser.add_option('--invalidate-cache',
 
                           action='store_true',
 
                           dest='invalidate_cache',
 
                           help="Trigger cache invalidation event for repos. "
 
                                "OPTIONAL")
0 comments (0 inline, 0 general)