changeset 360:5bc81e597352

Fix incompatibility with a change to the versioncontrol layer in Trac 0.10.3
author cmlenz
date Fri, 19 Jan 2007 15:19:51 +0000
parents c36dcff28f75
children 109800464463
files ChangeLog bitten/queue.py bitten/trac_ext/web_ui.py
diffstat 3 files changed, 32 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Version 0.5.4
+(?, from 0.5.x branch)
+http://bitten.cmlenz.net/repos/bitten/tags/0.5.4
+
+ * Fix incompatibility with Trac 0.10.3.
+
 Version 0.5.3
 (18 April 2006, from 0.5.x branch)
 http://bitten.cmlenz.net/repos/bitten/tags/0.5.3
--- a/bitten/queue.py
+++ b/bitten/queue.py
@@ -158,7 +158,6 @@
 
             return None, None
         finally:
-            repos.close()
             db = self.env.get_db_cnx()
             for build in builds_to_delete:
                 build.delete(db=db)
@@ -173,30 +172,27 @@
         configuration being in the build queue.
         """
         repos = self.env.get_repository()
-        try:
+        if hasattr(repos, 'sync'):
             repos.sync()
 
-            db = self.env.get_db_cnx()
-            builds = []
-            for config in BuildConfig.select(self.env, db=db):
-                for platform, rev, build in collect_changes(repos, config, db):
-                    if build is None:
-                        log.info('Enqueuing build of configuration "%s" at '
-                                 'revision [%s] on %s', config.name, rev,
-                                 platform.name)
-                        build = Build(self.env, config=config.name,
-                                      platform=platform.id, rev=str(rev),
-                                      rev_time = repos.get_changeset(rev).date)
-                        builds.append(build)
-                        break
-                    elif not self.build_all:
-                        break
-            for build in builds:
-                build.insert(db=db)
-            db.commit()
-
-        finally:
-            repos.close()
+        db = self.env.get_db_cnx()
+        builds = []
+        for config in BuildConfig.select(self.env, db=db):
+            for platform, rev, build in collect_changes(repos, config, db):
+                if build is None:
+                    log.info('Enqueuing build of configuration "%s" at '
+                             'revision [%s] on %s', config.name, rev,
+                             platform.name)
+                    build = Build(self.env, config=config.name,
+                                  platform=platform.id, rev=str(rev),
+                                  rev_time = repos.get_changeset(rev).date)
+                    builds.append(build)
+                    break
+                elif not self.build_all:
+                    break
+        for build in builds:
+            build.insert(db=db)
+        db.commit()
 
     def reset_orphaned_builds(self):
         """Reset all in-progress builds to PENDING state.
--- a/bitten/trac_ext/web_ui.py
+++ b/bitten/trac_ext/web_ui.py
@@ -364,7 +364,9 @@
                 continue
 
             repos = self.env.get_repository(req.authname)
-            repos.sync()
+            if hasattr(repos, 'sync'):
+                repos.sync()
+
             prev_rev = None
             for platform, rev, build in collect_changes(repos, config):
                 if rev != prev_rev:
@@ -439,9 +441,11 @@
         more = False
         req.hdf['page.number'] = page
 
+        repos = self.env.get_repository(req.authname)
+        if hasattr(repos, 'sync'):
+            repos.sync()
+
         builds_per_page = 12 * len(platforms)
-        repos = self.env.get_repository(req.authname)
-        repos.sync()
         idx = 0
         for platform, rev, build in collect_changes(repos, config):
             if idx >= page * builds_per_page:
Copyright (C) 2012-2017 Edgewall Software