Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: gcl.py

Issue 6722014: For now, stop suggesting reviewers during 'gcl change'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 def GenerateDiff(files, root=None): 756 def GenerateDiff(files, root=None):
757 return SVN.GenerateDiff(files, root=root) 757 return SVN.GenerateDiff(files, root=root)
758 758
759 759
760 def OptionallyDoPresubmitChecks(change_info, committing, args): 760 def OptionallyDoPresubmitChecks(change_info, committing, args):
761 if FilterFlag(args, "--no_presubmit") or FilterFlag(args, "--force"): 761 if FilterFlag(args, "--no_presubmit") or FilterFlag(args, "--force"):
762 return presubmit_support.PresubmitOutput() 762 return presubmit_support.PresubmitOutput()
763 return DoPresubmitChecks(change_info, committing, True) 763 return DoPresubmitChecks(change_info, committing, True)
764 764
765 765
766 def suggest_reviewers(change_info, affected_files):
767 owners_db = owners.Database(change_info.GetLocalRoot(), fopen=file,
768 os_path=os.path)
769 return owners_db.reviewers_for([f[1] for f in affected_files])
770
771
772 def defer_attributes(a, b): 766 def defer_attributes(a, b):
773 """Copy attributes from an object (like a function) to another.""" 767 """Copy attributes from an object (like a function) to another."""
774 for x in dir(a): 768 for x in dir(a):
775 if not getattr(b, x, None): 769 if not getattr(b, x, None):
776 setattr(b, x, getattr(a, x)) 770 setattr(b, x, getattr(a, x))
777 771
778 772
779 def need_change(function): 773 def need_change(function):
780 """Converts args -> change_info.""" 774 """Converts args -> change_info."""
781 # pylint: disable=W0612,W0621 775 # pylint: disable=W0612,W0621
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 description = change_info.description 1085 description = change_info.description
1092 1086
1093 other_files = GetFilesNotInCL() 1087 other_files = GetFilesNotInCL()
1094 1088
1095 # Edited files (as opposed to files with only changed properties) will have 1089 # Edited files (as opposed to files with only changed properties) will have
1096 # a letter for the first character in the status string. 1090 # a letter for the first character in the status string.
1097 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE) 1091 file_re = re.compile(r"^[a-z].+\Z", re.IGNORECASE)
1098 affected_files = [x for x in other_files if file_re.match(x[0])] 1092 affected_files = [x for x in other_files if file_re.match(x[0])]
1099 unaffected_files = [x for x in other_files if not file_re.match(x[0])] 1093 unaffected_files = [x for x in other_files if not file_re.match(x[0])]
1100 1094
1101 if not change_info.reviewers:
1102 files_for_review = affected_files[:]
1103 files_for_review.extend(change_info.GetFiles())
1104 suggested_reviewers = suggest_reviewers(change_info, files_for_review)
1105 if suggested_reviewers:
1106 reviewers_re = re.compile(REVIEWERS_REGEX)
1107 if not any(reviewers_re.match(l) for l in description.splitlines()):
1108 description += '\n\nR=' + ','.join(suggested_reviewers)
1109
1110 description = description.rstrip() + '\n' 1095 description = description.rstrip() + '\n'
1111 1096
1112 separator1 = ("\n---All lines above this line become the description.\n" 1097 separator1 = ("\n---All lines above this line become the description.\n"
1113 "---Repository Root: " + change_info.GetLocalRoot() + "\n" 1098 "---Repository Root: " + change_info.GetLocalRoot() + "\n"
1114 "---Paths in this changelist (" + change_info.name + "):\n") 1099 "---Paths in this changelist (" + change_info.name + "):\n")
1115 separator2 = "\n\n---Paths modified but not in any changelist:\n\n" 1100 separator2 = "\n\n---Paths modified but not in any changelist:\n\n"
1116 text = (description + separator1 + '\n' + 1101 text = (description + separator1 + '\n' +
1117 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()])) 1102 '\n'.join([f[0] + f[1] for f in change_info.GetFiles()]))
1118 1103
1119 if change_info.Exists(): 1104 if change_info.Exists():
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 if e.code != 500: 1452 if e.code != 500:
1468 raise 1453 raise
1469 print >> sys.stderr, ( 1454 print >> sys.stderr, (
1470 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1455 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1471 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1456 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1472 return 1 1457 return 1
1473 1458
1474 1459
1475 if __name__ == "__main__": 1460 if __name__ == "__main__":
1476 sys.exit(main(sys.argv[1:])) 1461 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698