Skip to content

Commit

Permalink
Merged new features from 0.11 branch (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
cboos committed Apr 27, 2010
2 parents 1669cef + e17bc42 commit f27aba1
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ HudsonTrac.egg-info
.svn
*~
*.bak
*.patch
*.mo
42 changes: 28 additions & 14 deletions HudsonTrac/HudsonTracPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class HudsonTracPlugin(Component):
Whether to display the build descriptions for each build
instead of the canned "Build finished successfully etc."
messages.""")
display_building = BoolOption('hudson', 'display_building', False,
'Also show in-progress builds (pulsating green ball)')

def __init__(self):
# i18n
Expand Down Expand Up @@ -105,9 +107,9 @@ def __init__(self):
'[timestamp>=%(start)s][timestamp<=%(stop)s]')
depth += 1

self.info_url = ('%s?xpath=%s&depth=%s&exclude='
'//action|//artifact|//changeSet|'
'//culprit&wrapper=builds' %
self.info_url = ('%s?xpath=%s&depth=%s'
'&exclude=//action|//artifact|//changeSet'
'&wrapper=builds' %
(api_url.replace('%', '%%'), path, depth))

self.env.log.debug("Build-info url: '%s'", self.info_url)
Expand Down Expand Up @@ -194,32 +196,44 @@ def get_number(parent, child):
for entry in info.documentElement.getElementsByTagName("build"):
# ignore builds that are still running
if get_string(entry, 'building') == 'true':
continue
if not self.display_building:
continue
else:
result = 'INPROGRESS'
else:
result = get_string(entry, 'result')

# create timeline entry
started = get_number(entry, 'timestamp')
completed = started + get_number(entry, 'duration')
started /= 1000
completed /= 1000

result = get_string(entry, 'result')

message, kind = {
'SUCCESS': (_('Build finished successfully'),
('build-successful',
'build-successful-alt')[self.alt_succ]),
'UNSTABLE': (_('Build unstable'), 'build-unstable'),
'ABORTED': (_('Build aborted'), 'build-aborted'),
'INPROGRESS': (_('Build in progress'), 'build-inprogress'),
}.get(result, (_('Build failed'), 'build-failed'))

if self.use_desc:
message = get_string(entry, 'description') or message

comment = _("%(message)s after %(elapsed)s",
message=message,
elapsed=pretty_timedelta(started, completed))
href = get_string(entry, 'url')
title = tag_('Build %(name)s (%(result)s)',
name=tag.em(get_string(entry, 'fullDisplayName')),
result=result.lower())
author = get_string(entry, 'fullName')
data = (get_string(entry, 'fullDisplayName'),
get_string(entry, 'url'),
result, message, started, completed)
yield kind, completed, author, data

yield kind, href, title, completed, None, comment
def render_timeline_event(self, context, field, event):
name, url, result, message, started, completed = event[3]
if field == 'title':
title = tag_('Build %(name)s (%(result)s)',
name=tag.em(name), result=result.lower())
elif field == 'description':
return _("%(message)s after %(elapsed)s", message=message,
elapsed=pretty_timedelta(started, completed))
elif field == 'url':
return url
1 change: 1 addition & 0 deletions HudsonTrac/htdocs/hudsontrac.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dt.build-successful-alt a { background-image: url(success-alt.gif) !important }
dt.build-failed a { background-image: url(failed.gif) !important }
dt.build-aborted a { background-image: url(aborted.gif) !important }
dt.build-unstable a { background-image: url(unstable.gif) !important }
dt.build-inprogress a { background-image: url(inprogress.gif) !important }
Binary file added HudsonTrac/htdocs/inprogress.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions gitignore

This file was deleted.

0 comments on commit f27aba1

Please sign in to comment.