OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Client-side script to send a try job to the try server. It communicates to | 6 """Client-side script to send a try job to the try server. It communicates to |
7 the try server by either writting to a svn repository or by directly connecting | 7 the try server by either writting to a svn repository or by directly connecting |
8 to the server by HTTP. | 8 to the server by HTTP. |
9 """ | 9 """ |
10 | 10 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 file_path = new_file.split('\t')[0].strip() | 483 file_path = new_file.split('\t')[0].strip() |
484 if file_path.startswith('a/'): | 484 if file_path.startswith('a/'): |
485 file_path = file_path[2:] | 485 file_path = file_path[2:] |
486 changed_files.append(('M', file_path)) | 486 changed_files.append(('M', file_path)) |
487 diff[i] = diff[i][0:4] + new_file | 487 diff[i] = diff[i][0:4] + new_file |
488 return (diff, changed_files) | 488 return (diff, changed_files) |
489 | 489 |
490 | 490 |
491 def TryChange(argv, | 491 def TryChange(argv, |
492 change, | 492 change, |
493 file_list, | |
494 swallow_exception, | 493 swallow_exception, |
495 prog=None, | 494 prog=None, |
496 extra_epilog=None): | 495 extra_epilog=None): |
497 """ | 496 """ |
498 Args: | 497 Args: |
499 argv: Arguments and options. | 498 argv: Arguments and options. |
500 file_list: Default value to pass to --file. | 499 change: Change instance corresponding to the CL. |
501 swallow_exception: Whether we raise or swallow exceptions. | 500 swallow_exception: Whether we raise or swallow exceptions. |
502 """ | 501 """ |
| 502 file_list = [] |
| 503 if change: |
| 504 file_list = [f.LocalPath() for f in change.AffectedFiles()] |
| 505 |
503 # Parse argv | 506 # Parse argv |
504 parser = optparse.OptionParser(usage=USAGE, | 507 parser = optparse.OptionParser(usage=USAGE, |
505 version=__version__, | 508 version=__version__, |
506 prog=prog) | 509 prog=prog) |
507 epilog = EPILOG % { 'prog': prog } | 510 epilog = EPILOG % { 'prog': prog } |
508 if extra_epilog: | 511 if extra_epilog: |
509 epilog += extra_epilog | 512 epilog += extra_epilog |
510 parser.epilog = epilog | 513 parser.epilog = epilog |
511 # Remove epilog formatting | 514 # Remove epilog formatting |
512 parser.format_epilog = lambda x: parser.epilog | 515 parser.format_epilog = lambda x: parser.epilog |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 print >> sys.stderr, e | 802 print >> sys.stderr, e |
800 return 1 | 803 return 1 |
801 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 804 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
802 print >> sys.stderr, e | 805 print >> sys.stderr, e |
803 return 1 | 806 return 1 |
804 return 0 | 807 return 0 |
805 | 808 |
806 | 809 |
807 if __name__ == "__main__": | 810 if __name__ == "__main__": |
808 fix_encoding.fix_encoding() | 811 fix_encoding.fix_encoding() |
809 sys.exit(TryChange(None, None, [], False)) | 812 sys.exit(TryChange(None, None, False)) |
OLD | NEW |