mod_hgpoll.py

changeset 110
b2770c43b752
parent 87
9e757b602586
child 111
44d9aea72947
equal deleted inserted replaced
109:87ad0c1b3405 110:b2770c43b752
113 113
114 username = Config.find_developer_by_email (email) 114 username = Config.find_developer_by_email (email)
115 115
116 if username != '': 116 if username != '':
117 author = username 117 author = username
118 118
119 # Try prettify the diffstat
120 rex = re.compile (r'^([0-9]+): \+([0-9]+)/-([0-9]+)$')
121 match = rex.match (diffstat)
122
123 if match:
124 diffstat = "%s\003:\0033 +%s\003/\0034-%s\003" % (match.group (1), match.group (2), match.group (3))
125
119 if delta.days < 4: 126 if delta.days < 4:
120 if delta.days == 0: 127 if delta.days == 0:
121 if delta.seconds < 60: 128 if delta.seconds < 60:
122 datestring = 'just now' 129 datestring = 'just now'
123 elif delta.seconds < 3600: 130 elif delta.seconds < 3600:
129 else: 136 else:
130 datestring = '%d day%s ago' % (delta.days, plural (delta.days)) 137 datestring = '%d day%s ago' % (delta.days, plural (delta.days))
131 else: 138 else:
132 datestring = 'on %s' % (str (date)) 139 datestring = 'on %s' % (str (date))
133 140
134 bot.privmsg (replyto, 'changeset %s (%s %s): committed by %s %s (%s)' % \ 141 bot.privmsg (replyto, 'changeset\0035 %s (%s %s)\003: committed by\0032 %s\003 %s,\0032 %s' % \
135 (node, zanversion, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat)) 142 (node, zanversion, date.strftime ('%y%m%d-%H%M'), author, datestring, diffstat))
136 143
137 for line in message.split ('\n'): 144 for line in message.split ('\n'):
138 bot.privmsg (replyto, ' ' + line) 145 bot.privmsg (replyto, ' ' + line)
139 except hgapi.HgException as e: 146 except hgapi.HgException as e:

mercurial