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

Side by Side Diff: presubmit_canned_checks.py

Issue 6684026: fix case where an issue may not have any messages yet (Closed) Base URL: http://src.chromium.org/svn/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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generic presubmit checks that can be reused by other presubmit checks.""" 5 """Generic presubmit checks that can be reused by other presubmit checks."""
6 6
7 ### Description checks 7 ### Description checks
8 8
9 def CheckChangeHasTestField(input_api, output_api): 9 def CheckChangeHasTestField(input_api, output_api):
10 """Requires that the changelist have a TEST= field.""" 10 """Requires that the changelist have a TEST= field."""
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 owner = input_api.re.escape(issue_props['owner']) 663 owner = input_api.re.escape(issue_props['owner'])
664 664
665 # TODO(dpranke): This mimics the logic in 665 # TODO(dpranke): This mimics the logic in
666 # /tools/commit-queue/verifiers/reviewer_lgtm.py 666 # /tools/commit-queue/verifiers/reviewer_lgtm.py
667 # We should share the code and/or remove the check there where it is 667 # We should share the code and/or remove the check there where it is
668 # redundant (since the commit queue also enforces the presubmit checks). 668 # redundant (since the commit queue also enforces the presubmit checks).
669 def match_reviewer(r): 669 def match_reviewer(r):
670 return email_regexp.match(r) and not input_api.re.match(owner, r) 670 return email_regexp.match(r) and not input_api.re.match(owner, r)
671 671
672 approvers = [] 672 approvers = []
673 for m in issue_props['messages']: 673 for m in issue_props.get('messages', []):
674 if 'lgtm' in m['text'].lower() and match_reviewer(m['sender']): 674 if 'lgtm' in m['text'].lower() and match_reviewer(m['sender']):
675 approvers.append(m['sender']) 675 approvers.append(m['sender'])
676 return set(approvers) 676 return set(approvers)
677 677
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698