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 |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 for filename in unknown_files: | 726 for filename in unknown_files: |
727 print "? %s" % filename | 727 print "? %s" % filename |
728 return 0 | 728 return 0 |
729 | 729 |
730 | 730 |
731 def GenerateDiff(files): | 731 def GenerateDiff(files): |
732 return SVN.GenerateDiff( | 732 return SVN.GenerateDiff( |
733 files, GetRepositoryRoot(), full_move=False, revision=None) | 733 files, GetRepositoryRoot(), full_move=False, revision=None) |
734 | 734 |
735 | 735 |
736 def GetTreeStatus(): | |
737 tree_status_url = GetCodeReviewSetting('STATUS') | |
738 return git_cl.GetTreeStatus(tree_status_url) if tree_status_url else "unset" | |
iannucci
2014/01/14 19:45:58
this should still probably return None instead of
| |
739 | |
740 | |
736 def OptionallyDoPresubmitChecks(change_info, committing, args): | 741 def OptionallyDoPresubmitChecks(change_info, committing, args): |
737 if FilterFlag(args, "--no_presubmit") or FilterFlag(args, "--force"): | 742 if FilterFlag(args, "--no_presubmit") or FilterFlag(args, "--force"): |
738 breakpad.SendStack( | 743 breakpad.SendStack( |
739 breakpad.DEFAULT_URL + '/breakpad', | 744 breakpad.DEFAULT_URL + '/breakpad', |
740 'GclHooksBypassedCommit', | 745 'GclHooksBypassedCommit', |
741 'Issue %s/%s bypassed hook when committing' % | 746 'Issue %s/%s bypassed hook when committing (tree status was "%s")' % |
742 (change_info.rietveld, change_info.issue), | 747 (change_info.rietveld, change_info.issue, GetTreeStatus()), |
743 verbose=False) | 748 verbose=False) |
744 return presubmit_support.PresubmitOutput() | 749 return presubmit_support.PresubmitOutput() |
745 return DoPresubmitChecks(change_info, committing, True) | 750 return DoPresubmitChecks(change_info, committing, True) |
746 | 751 |
747 | 752 |
748 def defer_attributes(a, b): | 753 def defer_attributes(a, b): |
749 """Copy attributes from an object (like a function) to another.""" | 754 """Copy attributes from an object (like a function) to another.""" |
750 for x in dir(a): | 755 for x in dir(a): |
751 if not getattr(b, x, None): | 756 if not getattr(b, x, None): |
752 setattr(b, x, getattr(a, x)) | 757 setattr(b, x, getattr(a, x)) |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1058 viewvc_url = GetCodeReviewSetting('VIEW_VC') | 1063 viewvc_url = GetCodeReviewSetting('VIEW_VC') |
1059 if viewvc_url and revision: | 1064 if viewvc_url and revision: |
1060 change_info.append_footer('Committed: ' + viewvc_url + revision) | 1065 change_info.append_footer('Committed: ' + viewvc_url + revision) |
1061 elif revision: | 1066 elif revision: |
1062 change_info.append_footer('Committed: ' + revision) | 1067 change_info.append_footer('Committed: ' + revision) |
1063 change_info.CloseIssue() | 1068 change_info.CloseIssue() |
1064 props = change_info.RpcServer().get_issue_properties( | 1069 props = change_info.RpcServer().get_issue_properties( |
1065 change_info.issue, False) | 1070 change_info.issue, False) |
1066 patch_num = len(props['patchsets']) | 1071 patch_num = len(props['patchsets']) |
1067 comment = "Committed patchset #%d manually as r%s" % (patch_num, revision) | 1072 comment = "Committed patchset #%d manually as r%s" % (patch_num, revision) |
1068 comment += ' (presubmit successful).' if not bypassed else '.' | 1073 if bypassed: |
1074 comment += ' (tree was closed).' if GetTreeStatus() == 'closed' else '.' | |
Dirk Pranke
2014/01/14 22:56:21
Since "tree was closed" is not the same thing as "
| |
1075 else: | |
1076 comment += ' (presubmit successful).' | |
1069 change_info.AddComment(comment) | 1077 change_info.AddComment(comment) |
1070 return 0 | 1078 return 0 |
1071 | 1079 |
1072 | 1080 |
1073 def CMDchange(args): | 1081 def CMDchange(args): |
1074 """Creates or edits a changelist. | 1082 """Creates or edits a changelist. |
1075 | 1083 |
1076 Only scans the current directory and subdirectories. | 1084 Only scans the current directory and subdirectories. |
1077 """ | 1085 """ |
1078 # Verify the user is running the change command from a read-write checkout. | 1086 # Verify the user is running the change command from a read-write checkout. |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 raise | 1492 raise |
1485 print >> sys.stderr, ( | 1493 print >> sys.stderr, ( |
1486 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1494 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1487 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1495 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1488 return 1 | 1496 return 1 |
1489 | 1497 |
1490 | 1498 |
1491 if __name__ == "__main__": | 1499 if __name__ == "__main__": |
1492 fix_encoding.fix_encoding() | 1500 fix_encoding.fix_encoding() |
1493 sys.exit(main(sys.argv[1:])) | 1501 sys.exit(main(sys.argv[1:])) |
OLD | NEW |