Changeset - 56cdbcf0678a
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-12-18 18:44:33
marcin@python-works.com
made update repoinfo script more failsafe when dealing with database entries not synced with filesystem
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/update_repoinfo.py
Show inline comments
 
@@ -52,34 +52,35 @@ class UpdateCommand(BasePasterCommand):
 
    usage = "CONFIG_FILE"
 
    summary = "Cleanup deleted repos"
 
    group_name = "RhodeCode"
 
    takes_config_file = -1
 
    parser = Command.standard_parser(verbose=True)
 

	
 
    def command(self):
 
        logging.config.fileConfig(self.path_to_ini_file)
 
        from pylons import config
 

	
 
        #get to remove repos !!
 
        add_cache(config)
 
        engine = engine_from_config(config, 'sqlalchemy.db1.')
 
        init_model(engine)
 

	
 
        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()
 
        for repo in repo_list:
 
            last_change = repo.scm_instance.last_change
 
            last_change = (repo.scm_instance.last_change if repo.scm_instance
 
                           else datetime.datetime.utcfromtimestamp(0))
 
            repo.update_last_change(last_change)
 

	
 
    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",
 
                          )
0 comments (0 inline, 0 general)