changeset 2635:d6fa7805e687 beta

we must rollback if repo2db mapper cleanup fails ! Session blows up, and that code still throws an error without it
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 20 Jul 2012 12:52:28 +0200
parents 4b17216f2110
children 4dbc00e9d0c3
files rhodecode/lib/utils.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/utils.py	Fri Jul 20 12:05:32 2012 +0200
+++ b/rhodecode/lib/utils.py	Fri Jul 20 12:52:28 2012 +0200
@@ -479,7 +479,7 @@
         # remove from database those repositories that are not in the filesystem
         for repo in sa.query(Repository).all():
             if repo.repo_name not in initial_repo_list.keys():
-                log.debug("Removing non existing repository found in db %s" %
+                log.debug("Removing non existing repository found in db `%s`" %
                           repo.repo_name)
                 try:
                     sa.delete(repo)
@@ -488,6 +488,7 @@
                 except:
                     #don't hold further removals on error
                     log.error(traceback.format_exc())
+                    sa.rollback()
 
     # clear cache keys
     log.debug("Clearing cache keys now...")