OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
11 import json | 11 import json |
12 import optparse | 12 import optparse |
13 import os | 13 import os |
14 import random | 14 import random |
15 import re | 15 import re |
16 import ssl | |
16 import string | 17 import string |
17 import sys | 18 import sys |
18 import tempfile | 19 import tempfile |
19 import time | 20 import time |
20 import urllib2 | 21 import urllib2 |
21 | 22 |
22 import breakpad # pylint: disable=W0611 | 23 import breakpad # pylint: disable=W0611 |
23 | 24 |
24 | 25 |
25 import fix_encoding | 26 import fix_encoding |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 | 394 |
394 def AddComment(self, comment): | 395 def AddComment(self, comment): |
395 """Adds a comment for an issue on Rietveld. | 396 """Adds a comment for an issue on Rietveld. |
396 As a side effect, this will email everyone associated with the issue.""" | 397 As a side effect, this will email everyone associated with the issue.""" |
397 return self.RpcServer().add_comment(self.issue, comment) | 398 return self.RpcServer().add_comment(self.issue, comment) |
398 | 399 |
399 def PrimeLint(self): | 400 def PrimeLint(self): |
400 """Do background work on Rietveld to lint the file so that the results are | 401 """Do background work on Rietveld to lint the file so that the results are |
401 ready when the issue is viewed.""" | 402 ready when the issue is viewed.""" |
402 if self.issue and self.patchset: | 403 if self.issue and self.patchset: |
403 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), | 404 try: |
M-A Ruel
2014/01/09 02:08:14
You could remove the call completely.
wtc
2014/01/09 15:07:34
Does "git cl upload" also run lint job on Rietveld
wtc
2014/01/09 17:58:27
Thanks for the reply.
I suspect the "background w
| |
404 timeout=10) | 405 print "Linting the CL on Rietveld..." |
406 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), | |
407 timeout=60) | |
408 print "Lint done" | |
409 except ssl.SSLError as e: | |
410 if e.message == 'The read operation timed out': | |
411 print "Rietveld took too long to lint the CL. Read timeout ignored." | |
412 else: | |
413 raise | |
405 | 414 |
406 def SendToRietveld(self, request_path, timeout=None, **kwargs): | 415 def SendToRietveld(self, request_path, timeout=None, **kwargs): |
407 """Send a POST/GET to Rietveld. Returns the response body.""" | 416 """Send a POST/GET to Rietveld. Returns the response body.""" |
408 try: | 417 try: |
409 return self.RpcServer().Send(request_path, timeout=timeout, **kwargs) | 418 return self.RpcServer().Send(request_path, timeout=timeout, **kwargs) |
410 except urllib2.URLError: | 419 except urllib2.URLError: |
411 if timeout is None: | 420 if timeout is None: |
412 ErrorExit('Error accessing url %s' % request_path) | 421 ErrorExit('Error accessing url %s' % request_path) |
413 else: | 422 else: |
414 return None | 423 return None |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1477 raise | 1486 raise |
1478 print >> sys.stderr, ( | 1487 print >> sys.stderr, ( |
1479 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1488 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1480 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1489 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1481 return 1 | 1490 return 1 |
1482 | 1491 |
1483 | 1492 |
1484 if __name__ == "__main__": | 1493 if __name__ == "__main__": |
1485 fix_encoding.fix_encoding() | 1494 fix_encoding.fix_encoding() |
1486 sys.exit(main(sys.argv[1:])) | 1495 sys.exit(main(sys.argv[1:])) |
OLD | NEW |