hgpoll.py

changeset 166
2ddfa9840eea
parent 165
8131cf387e3d
child 167
032c90f1727b
equal deleted inserted replaced
165:8131cf387e3d 166:2ddfa9840eea
170 # Announce on IRC 170 # Announce on IRC
171 for irc_client in Irc.all_clients: 171 for irc_client in Irc.all_clients:
172 for channel in irc_client.channels: 172 for channel in irc_client.channels:
173 if channel.get_value ('btannounce', default=True): 173 if channel.get_value ('btannounce', default=True):
174 irc_client.privmsg (channel.get_value ('name'), 174 irc_client.privmsg (channel.get_value ('name'),
175 "\003%d%s\003: commit\0035 %s\003 addresses issue\002\0032 %d\002" % \ 175 "\003%d%s\003: commit\0035 %s\003 addresses issue\002\0032 %d\002: %s" % \
176 (repo.color, repo.name, cset, ticket_id)) 176 (repo.color, repo.name, cset, ticket_id), Bt.get_ticket_url(ticket_id))
177 irc_client.privmsg (channel.get_value ('name'),
178 "Read all about it here: " + Bt.get_ticket_url (ticket_id))
179 177
180 if need_update: 178 if need_update:
181 # We need to remove the note data, otherwise the ticket notes 179 # We need to remove the note data, otherwise the ticket notes
182 # will get unnecessary updates. WTF, MantisBT? 180 # will get unnecessary updates. WTF, MantisBT?
183 ticket_data.notes = [] 181 ticket_data.notes = []
286 if not isMergeFromSandbox: 284 if not isMergeFromSandbox:
287 commitMessage = """\003%d%s\003: new %s\0035 %s%s\003 by\0032 %s\003: %s""" % \ 285 commitMessage = """\003%d%s\003: new %s\0035 %s%s\003 by\0032 %s\003: %s""" % \
288 (repo.color, repo.name, descriptor, commit['node'], commit['bookmarks'], 286 (repo.color, repo.name, descriptor, commit['node'], commit['bookmarks'],
289 committer, utility.shorten_link (commit['url'])) 287 committer, utility.shorten_link (commit['url']))
290 288
289 multiline = ('\n' in commit['message']) or len(commit['message']) >= 256
290
291 if not multiline:
292 commitMessage += ": %s" % commit['message']
293
291 for length in [LENGTH_MINIMUM, LENGTH_SHORT, LENGTH_FULL]: 294 for length in [LENGTH_MINIMUM, LENGTH_SHORT, LENGTH_FULL]:
292 messages[length].append (commitMessage) 295 messages[length].append (commitMessage)
293 296
294 messages[LENGTH_SHORT].append (' ' + commit['message'].splitlines()[0]) 297 if not multiline:
295 298 messages[LENGTH_SHORT].append (' ' + commit['message'].splitlines()[0])
296 for line in commit['message'].splitlines()[:4]: 299
297 messages[LENGTH_FULL].append (' ' + line) 300 for line in commit['message'].splitlines()[:4]:
301 messages[LENGTH_FULL].append (' ' + line)
298 else: 302 else:
299 commitMessage = """\003%d%s\003: %s\0035 %s\003 by\0032 %s\003 was pulled: %s""" % \ 303 commitMessage = """\003%d%s\003: %s\0035 %s\003 by\0032 %s\003 was pulled: %s""" % \
300 (repo.color, repo.name, descriptor, commit['node'], committer, 304 (repo.color, repo.name, descriptor, commit['node'], committer,
301 utility.shorten_link (commit['url'])) 305 utility.shorten_link (commit['url']))
302 306

mercurial