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

Delta Between Two Patch Sets: beanbot-client.py

Issue 8483004: abpbot: Send each commit's branch to IRC (Closed)
Left Patch Set: Created Oct. 2, 2012, 5:37 a.m.
Right Patch Set: Created Oct. 2, 2012, 10:57 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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, branch, author, rev, description = sys.argv[1:6] 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[%(branch)s]" 23 "%(IRC_RED)s%(repo)s"
24 "%(IRC_NORMAL)[%(branch)s] "
24 "%(IRC_NORMAL)s%(IRC_BOLD)s%(author)s " 25 "%(IRC_NORMAL)s%(IRC_BOLD)s%(author)s "
25 "%(IRC_NORMAL)s%(IRC_ULINE)s%(rev)s%(IRC_NORMAL)s " 26 "%(IRC_NORMAL)s%(IRC_ULINE)s%(rev)s%(IRC_NORMAL)s "
26 "%(description)s" % locals() 27 "%(description)s" % locals()
27 ) 28 )
28 if len(data) > 400: 29 if len(data) > 400:
29 data = data[:400] + "..." 30 data = data[:400] + "..."
30 sock = socket(AF_INET, SOCK_DGRAM) 31 sock = socket(AF_INET, SOCK_DGRAM)
31 sock.sendto(data, serve_addr) 32 sock.sendto(data, serve_addr)
32 sock.sendto("https://hg.adblockplus.org/%(repo)s/rev/%(rev)s" % locals(), serv e_addr) 33 sock.sendto("https://hg.adblockplus.org/%(repo)s/rev/%(rev)s" % locals(), serv e_addr)
33 sock.close() 34 sock.close()
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld