changeset 732:440b48bba3e9 0.6.x

Merged [806:809] from trunk.
author osimons
date Thu, 11 Feb 2010 17:43:22 +0000
parents df8d2cd7e50e
children 1f03b23e38ff
files bitten/build/hgtools.py bitten/build/javatools.py bitten/main.py doc/links.txt
diffstat 4 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/build/hgtools.py
+++ b/bitten/build/hgtools.py
@@ -18,11 +18,10 @@
     """
     args = ['pull', '-u']
     if revision:
-        args += ['-r', revision.split(':')[0]]
-    args += [dir_]
+        args += ['-r', revision.split(':')[1]]
 
     from bitten.build import shtools
-    returncode = shtools.execute(ctxt, file_='hg', args=args)
+    returncode = shtools.execute(ctxt, file_='hg', args=args, dir_=dir_)
     if returncode != 0:
         ctxt.error('hg pull -u failed (%s)' % returncode)
 
--- a/bitten/build/javatools.py
+++ b/bitten/build/javatools.py
@@ -135,7 +135,7 @@
                         # Sometimes the traceback isn't prefixed with the
                         # exception type and message, so add it in if needed
                         tracebackprefix = "%s: %s" % (result[0].attr['type'],
-                                                      result[0].attr['message'])
+                                    result[0].attr.get('message', ''))
                         if result[0].gettext().startswith(tracebackprefix):
                             test.append(xmlio.Element('traceback')[
                                         result[0].gettext()])
--- 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"``.
Copyright (C) 2012-2017 Edgewall Software