From: Greg Brockman Date: Tue, 23 Mar 2010 08:08:18 +0000 (-0400) Subject: Improved zephyred message X-Git-Url: http://andersk.mit.edu/gitweb/zcommit.git/commitdiff_plain/8ab831508a04c344c25c82e34be6775412f1d3da Improved zephyred message --- diff --git a/zcommit.py b/zcommit.py index 15a2236..dcfb201 100755 --- a/zcommit.py +++ b/zcommit.py @@ -68,16 +68,26 @@ class Application(object): logger.debug('Set zsig') for c in reversed(payload['commits']): inst = opts.get('instance', c['id'][:8]) + actions = [] + if c.get('added'): + actions.append('Added: %s\n' % c['added']) + if c.get('removed'): + actions.append('Removed: %s\n' % c['removed']) + if c.get('modified'): + actions.append('Modified: %s\n' % c['modified']) + if not actions: + actions = 'Something weird happened... could not figure out what action to take' info = {'name' : c['author']['name'], 'email' : c['author']['email'], 'message' : c['message'], 'timestamp' : c['timestamp'], - 'added' : '\n'.join(c['added'])} + 'actions' : actions} + msg = """%(name)s <%(email)s> %(message)s %(timestamp)s -- -%(added)s""" % info +%(actions)s""" % info zephyr(opts['class'], inst, zsig, msg) msg = 'Thanks for posting!' else: