Mercurial > bitten > bitten-test
changeset 730:a3197bba9c21
Support wiki-linking to individual build steps as well (as fragment). Example: `build:1#coverage`. Closes #518.
author | osimons |
---|---|
date | Thu, 11 Feb 2010 17:24:09 +0000 |
parents | 6b3de00356d1 |
children | 9b5630fdd35e |
files | bitten/main.py doc/links.txt |
diffstat | 2 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/main.py +++ b/bitten/main.py @@ -18,6 +18,7 @@ from trac.env import IEnvironmentSetupParticipant from trac.perm import IPermissionRequestor from trac.resource import IResourceManager +from trac.util.html import escape from trac.wiki import IWikiSyntaxProvider from bitten.api import IBuildListener from bitten.model import schema, schema_version, Build, BuildConfig @@ -100,6 +101,9 @@ def get_link_resolvers(self): def _format_link(formatter, ns, name, label): + segments = name.split('#') + name = segments[0] + step = len(segments) == 2 and segments[1] or '' try: name = int(name) except ValueError: @@ -109,9 +113,13 @@ config = BuildConfig.fetch(self.env, build.config) title = 'Build %d ([%s] of %s) by %s' % (build.id, build.rev, config.label, build.slave) + if step: + if not step.startswith('step_'): + step = 'step_' + step + step = '#' + escape(step) return '<a class="build" href="%s" title="%s">%s</a>' \ - % (formatter.href.build(build.config, build.id), title, - label) + % (formatter.href.build(build.config, build.id) + step, + title, label) return label yield 'build', _format_link
--- a/doc/links.txt +++ b/doc/links.txt @@ -6,5 +6,9 @@ Bitten supports the ability to link between any wiki-enabled objects in Trac. -To link to a particular build, use the TracLink syntax ``build:N`` (where ``N`` is the number of the build) - +To link to a particular build, use the TracLink syntax ``build:N`` +(where ``N`` is the number of the build). + +Linking to a particular step of the build is also supported by adding an +anchor reference, like ``build:N#Test``. If the step ID contains spaces, +the link must be quoted: ``build:"N#My Step"``.