# HG changeset patch # User cmlenz # Date 1169219991 0 # Node ID 5bc81e5973520ba12dbbc883fac9690fa8af34aa # Parent c36dcff28f757a7e6d19dd2c0b088f4ca4f7c573 Fix incompatibility with a change to the versioncontrol layer in Trac 0.10.3 diff --git a/ChangeLog b/ChangeLog --- 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 diff --git a/bitten/queue.py b/bitten/queue.py --- 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. diff --git a/bitten/trac_ext/web_ui.py b/bitten/trac_ext/web_ui.py --- 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: