Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 import os | 3 import os |
| 4 import re | 4 import re |
| 5 import subprocess | 5 import subprocess |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 try: | 8 try: |
| 9 options = {} | 9 options = {} |
| 10 query_string = os.environ['QUERY_STRING'].split('&') | 10 query_string = os.environ['QUERY_STRING'].split('&') |
| 11 for q in query_string: | 11 for q in query_string: |
| 12 opt = q.split('=') | 12 opt = q.split('=') |
| 13 options[opt[0]] = opt[1] | 13 options[opt[0]] = opt[1] |
| 14 if ('range' not in options or 'url' not in options or | 14 if ('range' not in options or 'url' not in options or |
| 15 not (options['url'].startswith('http://src.chromium.org/svn/') or | 15 not (options['url'].startswith('http://src.chromium.org/svn/') or |
| 16 options['url'].startswith('http://webrtc.googlecode.com/svn/') or | 16 options['url'].startswith('http://webrtc.googlecode.com/svn/') or |
| 17 options['url'].startswith('http://v8.googlecode.com/svn/')) or | 17 options['url'].startswith('http://v8.googlecode.com/svn/')) or |
| 18 not re.match(r'^(\d+):(\d+)$', options['range'])): | 18 not (re.match(r'^(\d+):(\d+)$', options['range']) or |
| 19 re.match(r'^{(\d{4}-(1[0-2]|0?[1-9])-(3[01]|[12][0-9]|0?[1-9]))}' | |
| 20 ':{(\d{4}-(1[0-2]|0?[1-9])-(3[01]|[12][0-9]|0?[1-9]))}$', | |
|
reveman
2014/04/25 21:46:28
fyi, this is not perfect. ie. it doesn't complain
| |
| 21 options['range']))): | |
| 19 print 'Content-Type: text/html' | 22 print 'Content-Type: text/html' |
| 20 print '' | 23 print '' |
| 21 print '' | 24 print '' |
| 22 sys.exit(1) | 25 sys.exit(1) |
| 23 c = ['svn', 'log', '--xml', '-v', '-r', options['range'], options['url']] | 26 c = ['svn', 'log', '--xml', '-v', '-r', options['range'], options['url']] |
| 24 print 'Content-Type: text/xml' | 27 print 'Content-Type: text/xml' |
| 25 print '' | 28 print '' |
| 26 sys.stdout.flush() | 29 sys.stdout.flush() |
| 27 subprocess.call(c) | 30 subprocess.call(c) |
| 28 except Exception, e: | 31 except Exception, e: |
| 29 sys.stderr.write(e) | 32 sys.stderr.write(e) |
| OLD | NEW |