Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: beanbot-client.py

Issue 8483004: abpbot: Send each commit's branch to IRC (Closed)
Patch Set: Created Oct. 2, 2012, 5:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import sys, re 3 import sys, re
4 from socket import * 4 from socket import *
5 5
6 serve_addr = ('localhost', 47701) 6 serve_addr = ('localhost', 47701)
7 7
8 if __name__ == '__main__': 8 if __name__ == '__main__':
9 IRC_BOLD = '\x02' 9 IRC_BOLD = '\x02'
10 IRC_ULINE = '\x1f' 10 IRC_ULINE = '\x1f'
11 IRC_NORMAL = '\x0f' 11 IRC_NORMAL = '\x0f'
12 IRC_RED = '\x034' 12 IRC_RED = '\x034'
13 IRC_LIME = '\x039' 13 IRC_LIME = '\x039'
14 IRC_BLUE = '\x0312' 14 IRC_BLUE = '\x0312'
15 15
16 repo, author, rev, description = sys.argv[1:5] 16 repo, branch, author, rev, description = sys.argv[1:6]
17 17
18 match = re.search(r'^\s*(.*?)\s*<.*>\s*$', author) 18 match = re.search(r'^\s*(.*?)\s*<.*>\s*$', author)
19 if match: 19 if match:
20 author = match.group(1) 20 author = match.group(1)
21 21
22 data = ( 22 data = (
23 "%(IRC_RED)s%(repo)s " 23 "%(IRC_RED)s%(repo)s[%(branch)s]"
24 "%(IRC_NORMAL)s%(IRC_BOLD)s%(author)s " 24 "%(IRC_NORMAL)s%(IRC_BOLD)s%(author)s "
25 "%(IRC_NORMAL)s%(IRC_ULINE)s%(rev)s%(IRC_NORMAL)s " 25 "%(IRC_NORMAL)s%(IRC_ULINE)s%(rev)s%(IRC_NORMAL)s "
26 "%(description)s" % locals() 26 "%(description)s" % locals()
27 ) 27 )
28 if len(data) > 400: 28 if len(data) > 400:
29 data = data[:400] + "..." 29 data = data[:400] + "..."
30 sock = socket(AF_INET, SOCK_DGRAM) 30 sock = socket(AF_INET, SOCK_DGRAM)
31 sock.sendto(data, serve_addr) 31 sock.sendto(data, serve_addr)
32 sock.sendto("https://hg.adblockplus.org/%(repo)s/rev/%(rev)s" % locals(), serv e_addr) 32 sock.sendto("https://hg.adblockplus.org/%(repo)s/rev/%(rev)s" % locals(), serv e_addr)
33 sock.close() 33 sock.close()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld