From: Neil Date: Sun, 11 Nov 2012 21:33:04 +0000 (+0200) Subject: Various cleanups and pep8 / pyflakes fixes X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=b95d5f1c0dae07272c1decd88a61973df8232be0;p=bzrirker.git Various cleanups and pep8 / pyflakes fixes --- diff --git a/irkerhook.py b/irkerhook.py index 2d6df23..d58b194 100644 --- a/irkerhook.py +++ b/irkerhook.py @@ -25,12 +25,13 @@ class IrkerSender(object): self.revno = self.branch.revision_id_to_revno(self._revision_id) def _format(self): + """Munge the commit info into an irc message""" delta = self.branch.repository.get_revision_delta(self._revision_id) files = [] - [files.append(f) for (f,_,_) in delta.added] - [files.append(f) for (f,_,_) in delta.removed] - [files.append(f) for (_,f,_,_,_,_) in delta.renamed] - [files.append(f) for (f,_,_,_,_) in delta.modified] + [files.append(f) for (f, _, _) in delta.added] + [files.append(f) for (f, _, _) in delta.removed] + [files.append(f) for (_, f, _, _, _, _) in delta.renamed] + [files.append(f) for (f, _, _, _, _) in delta.modified] fields = { 'project': self.project(), @@ -40,24 +41,15 @@ class IrkerSender(object): 'files': ' '.join(files), 'logmsg': self.revision.get_summary(), } - for name, value in self.colours(): - fields[name] = value + fields.update(self.colours()) 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 ' % fields) return text - 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': '', @@ -95,7 +87,7 @@ class IrkerSender(object): 'cyan': '\x0310', 'reset': '\x0F', } - return colours.iteritems() + return colours def project(self): project = self.config.get('irker_project') @@ -136,8 +128,6 @@ class IrkerSender(object): self.repository.unlock() self.branch.unlock() -opt_irker_url = Option('irker_url', - help='URL to mention for branch in messages.') opt_irker_channels = Option('irker_channels', help='Channel(s) to post commit messages to.') opt_irker_colours = Option('irker_colours',