Mon, 25 Jan 2016 15:31:13 +0200
Don't spam as much
hgpoll.py | file | annotate | diff | comparison | revisions |
--- a/hgpoll.py Tue Jan 12 21:14:26 2016 +0200 +++ b/hgpoll.py Mon Jan 25 15:31:13 2016 +0200 @@ -172,10 +172,8 @@ for channel in irc_client.channels: if channel.get_value ('btannounce', default=True): irc_client.privmsg (channel.get_value ('name'), - "\003%d%s\003: commit\0035 %s\003 addresses issue\002\0032 %d\002" % \ - (repo.color, repo.name, cset, ticket_id)) - irc_client.privmsg (channel.get_value ('name'), - "Read all about it here: " + Bt.get_ticket_url (ticket_id)) + "\003%d%s\003: commit\0035 %s\003 addresses issue\002\0032 %d\002: %s" % \ + (repo.color, repo.name, cset, ticket_id), Bt.get_ticket_url(ticket_id)) if need_update: # We need to remove the note data, otherwise the ticket notes @@ -288,13 +286,19 @@ (repo.color, repo.name, descriptor, commit['node'], commit['bookmarks'], committer, utility.shorten_link (commit['url'])) + multiline = ('\n' in commit['message']) or len(commit['message']) >= 256 + + if not multiline: + commitMessage += ": %s" % commit['message'] + for length in [LENGTH_MINIMUM, LENGTH_SHORT, LENGTH_FULL]: messages[length].append (commitMessage) - messages[LENGTH_SHORT].append (' ' + commit['message'].splitlines()[0]) + if not multiline: + messages[LENGTH_SHORT].append (' ' + commit['message'].splitlines()[0]) - for line in commit['message'].splitlines()[:4]: - messages[LENGTH_FULL].append (' ' + line) + for line in commit['message'].splitlines()[:4]: + messages[LENGTH_FULL].append (' ' + line) else: commitMessage = """\003%d%s\003: %s\0035 %s\003 by\0032 %s\003 was pulled: %s""" % \ (repo.color, repo.name, descriptor, commit['node'], committer,