changeset 3523:e08321d4c106 beta

add --invalidate-cache option to update-repoinfo command
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 11 Mar 2013 15:31:30 +0100
parents 7174ee850baa
children af96fb19b53a
files rhodecode/lib/paster_commands/update_repoinfo.py
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/paster_commands/update_repoinfo.py	Sun Mar 10 22:53:25 2013 +0100
+++ b/rhodecode/lib/paster_commands/update_repoinfo.py	Mon Mar 11 15:31:30 2013 +0100
@@ -68,12 +68,21 @@
             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()
         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",
-                          )
+                           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")