- def body(self):
- from bzrlib import log
-
- rev1 = rev2 = self.revno
- if rev1 == 0:
- rev1 = None
- rev2 = None
-
- # use 'replace' so that we don't abort if trying to write out
- # in e.g. the default C locale.
-
- # Following bzr-email, we use StringIO.StringIO to minimise possible
- # unicode issues.
- from StringIO import StringIO
- outf = StringIO()
-
- lf = log.log_formatter('line',
- show_ids=True,
- to_file=outf
- )
-
- if len(self.revision.parent_ids) <= 1:
- # This is not a merge, so we can special case the display of one
- # revision, and not have to encur the show_log overhead.
- lr = log.LogRevision(self.revision, self.revno, 0, None)
- lf.log_revision(lr)
- else:
- # let the show_log code figure out what revisions need to be
- # displayed, as this is a merge
- log.show_log(self.branch,
- lf,
- start_revision=rev1,
- end_revision=rev2,
- verbose=True
- )
-
- return outf.getvalue()
-
- def url(self):
- """What URL to display in the subject of the mail"""
- url = self.config.get('irker_url')
- if url is None:
- url = self.config.get('public_branch')
- if url is None:
- url = self.branch.base
- return url
+ def colours(self):
+ """Utility function to handle the colours"""
+ colour_style = self.config.get('irker_colours')
+ 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):
+ project = self.config.get('irker_project')
+ if project is None:
+ project = 'No Project name set'
+ return project