# HG changeset patch # User cmlenz # Date 1128535917 0 # Node ID 42f555e1d648cd0e18a1d75de18f1c2d984ab9f9 # Parent 27ed440902f9c650c26bfba8958778a64b509cf7 Show the build status for the latest changeset for every build configuration on the main build status page. Closes #21. diff --git a/bitten/trac_ext/htdocs/bitten.css b/bitten/trac_ext/htdocs/bitten.css --- a/bitten/trac_ext/htdocs/bitten.css +++ b/bitten/trac_ext/htdocs/bitten.css @@ -17,6 +17,38 @@ #content.build h2.deactivated { text-decoration: line-through; } #content.build #prefs { line-height: 1.4em; } +#content.build table.builds { border-collapse: separate; + border-top: 1px solid #666; table-layout: fixed; +} +#content.build table.builds caption { font-weight: bold; text-align: left; } +#content.build table.builds th { padding: 0 .25em; text-align: left; + vertical-align: top; +} +#content.build table.builds th p { color: #666; font-size: smaller; + margin-top: 0; +} +#content.build table.builds th p.message { font-style: italic; } +#content.build table.builds td { color: #999; border: 1px solid; + padding: .25em .5em; vertical-align: top; +} +#content.build table.builds td :link, #content.build table.builds td :visited { + font-weight: bold; +} +#content.build table.builds td.completed { background: #9d9; border-color: #696; + color: #393; +} +#content.build table.builds td.failed { background: #d99; border-color: #966; + color: #933; +} +#content.build table.builds td.in-progress { background: #dd9; + border-color: #996; color: #993; +} +#content.build table.builds td p { font-size: smaller; margin-top: 0; } +#content.build table.builds .status { color: #000; } +#content.build table.builds .system { font-size: smaller; line-height: 1.2em; + margin: .5em 0; +} + #content.build form.config { margin-top: 1em; } #content.build form.config th { text-align: left; } #content.build form.config fieldset { margin-bottom: 1em; } diff --git a/bitten/trac_ext/templates/bitten_config.cs b/bitten/trac_ext/templates/bitten_config.cs --- a/bitten/trac_ext/templates/bitten_config.cs +++ b/bitten/trac_ext/templates/bitten_config.cs @@ -40,6 +40,38 @@ if:config.description ?>
+ + +
Latest builds
[] by

+

+ ()
/
SuccessFailedIn-progress
+

No build yet

+
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 @@ -18,11 +18,12 @@ import pkg_resources from trac.core import * from trac.Timeline import ITimelineEventProvider -from trac.util import escape, pretty_timedelta, format_date, format_datetime +from trac.util import escape, pretty_timedelta, format_date, format_datetime, \ + shorten_line from trac.web import IRequestHandler from trac.web.chrome import INavigationContributor, ITemplateProvider, \ add_link, add_stylesheet -from trac.wiki import wiki_to_html +from trac.wiki import wiki_to_html, wiki_to_oneliner from bitten.model import BuildConfig, TargetPlatform, Build, BuildStep, \ BuildLog, Report from bitten.queue import collect_changes @@ -30,7 +31,8 @@ from bitten.trac_ext.api import ILogFormatter, IReportSummarizer from bitten.util import xmlio -_status_label = {Build.IN_PROGRESS: 'in progress', +_status_label = {Build.PENDING: 'pending', + Build.IN_PROGRESS: 'in progress', Build.SUCCESS: 'completed', Build.FAILURE: 'failed'} @@ -329,17 +331,42 @@ show_all = True req.hdf['config.show_all'] = show_all - configurations = BuildConfig.select(self.env, include_inactive=show_all) - for idx, config in enumerate(configurations): + configs = BuildConfig.select(self.env, include_inactive=show_all) + for idx, config in enumerate(configs): + prefix = 'configs.%d' % idx description = config.description if description: description = wiki_to_html(description, self.env, req) - req.hdf['configs.%d' % idx] = { + req.hdf[prefix] = { 'name': config.name, 'label': config.label or config.name, 'active': config.active, 'path': config.path, 'description': description, 'href': self.env.href.build(config.name), } + if not config.active: + continue + + repos = self.env.get_repository(req.authname) + repos.sync() + prev_rev = None + for platform, rev, build in collect_changes(repos, config): + if rev != prev_rev: + if prev_rev is None: + chgset = repos.get_changeset(rev) + req.hdf[prefix + '.youngest_rev'] = { + 'id': rev, 'href': self.env.href.changeset(rev), + 'author': escape(chgset.author), + 'date': format_datetime(chgset.date), + 'message': wiki_to_oneliner( + shorten_line(chgset.message), self.env) + } + else: + break + prev_rev = rev + if build: + build_hdf = _build_to_hdf(self.env, req, build) + req.hdf[prefix + '.builds.%s' % platform.name] = build_hdf + req.hdf['page.mode'] = 'overview' req.hdf['config.can_create'] = req.perm.has_permission('BUILD_CREATE')