def _format(self):
fields = {
+ 'project': self.project(),
'committer': self.revision.committer,
- 'message': self.revision.get_summary(),
- 'revision': '%d' % self.revno,
- 'url': self.url()
+ 'repo': '',
+ 'rev': '%d' % self.revno,
+ 'files': '',
+ 'logmsg': self.revision.get_summary(),
+ 'url': self.url(),
}
- text = ''
- #for name, value in fields.items():
- # text = text.replace('$%s' % name, value)
+ for name, value in self.colours():
+ fields[name] = value
+ text = ('%(bold)s%(project)s:%(reset)s '
+ '%(green)s%(committer)s%(reset)s '
+ '%(repo)s * %(bold)s%(rev)s%(reset)s / '
+ ' %(bold)s%(files)s%(reset)s: %(logmsg)s '
+ '%(brown)s%(url)s%(reset)s' % fields)
return text
def body(self):
url = self.branch.base
return url
+ def colours(self):
+ colour_style = self.config.get('irker_colors')
+ colours = {
+ 'bold': '',
+ 'green': '',
+ 'blue': '',
+ 'red': '',
+ 'yellow': '',
+ 'brown': '',
+ 'magenta': '',
+ 'cyan': '',
+ 'reset': '',
+ }
+ # Vaues taken from irker's irkerhook.py
+ if colour_style == 'ANSI':
+ colours = {
+ 'bold': '\x1b[1m'
+ 'green': '\x1b[1;32m'
+ 'blue': '\x1b[1;34m'
+ 'red': '\x1b[1;31m'
+ 'yellow': '\x1b[1;33m'
+ 'brown': '\x1b[33m'
+ 'magenta': '\x1b[35m'
+ 'cyan': '\x1b[36m'
+ 'reset': '\x1b[0m'
+ }
+ elif colour_style == 'mIRC':
+ colours = {
+ 'bold': '\x02'
+ 'green': '\x0303'
+ 'blue': '\x0302'
+ 'red': '\x0305'
+ 'yellow': '\x0307'
+ 'brown': '\x0305'
+ 'magenta': '\x0306'
+ 'cyan': '\x0310'
+ 'reset': '\x0F'
+ }
+ return colours
+
+ def project(self):
+ projet = self.config.get('irker_project')
+ if project is None:
+ project = 'No Project name set'
+ return project
+
def send(self):
"""Send the info to irkerd.
"""