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

Side by Side Diff: presubmit_canned_checks.py

Issue 6646009: update git-cl for OWNERS file support via .git/hooks/pre-cl-* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: clean up after running owners-related git-cl tests 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 | « git_cl_hooks.py ('k') | presubmit_support.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 # 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 627
628 628
629 def CheckOwners(input_api, output_api, email_regexp=None, 629 def CheckOwners(input_api, output_api, email_regexp=None,
630 source_file_filter=None): 630 source_file_filter=None):
631 affected_files = set([f.LocalPath() for f in 631 affected_files = set([f.LocalPath() for f in
632 input_api.change.AffectedFiles(source_file_filter)]) 632 input_api.change.AffectedFiles(source_file_filter)])
633 owners_db = input_api.owners_db 633 owners_db = input_api.owners_db
634 if email_regexp: 634 if email_regexp:
635 owners_db.email_regexp = input_api.re.compile(email_regexp) 635 owners_db.email_regexp = input_api.re.compile(email_regexp)
636 636
637 if input_api.is_committing and input_api.is_tbr: 637 if input_api.is_committing and input_api.tbr:
638 return [output_api.PresubmitNotifyResult( 638 return [output_api.PresubmitNotifyResult(
639 '--tbr was specified, skipping OWNERS check')] 639 '--tbr was specified, skipping OWNERS check')]
640 elif input_api.is_committing: 640 elif input_api.is_committing:
641 approvers = _Approvers(input_api, owners_db.email_regexp) 641 approvers = _Approvers(input_api, owners_db.email_regexp)
642 missing_files = owners_db.files_not_covered_by(affected_files, approvers) 642 missing_files = owners_db.files_not_covered_by(affected_files, approvers)
643 if missing_files: 643 if missing_files:
644 return [output_api.PresubmitError('Missing LGTM from an OWNER for: %s' % 644 return [output_api.PresubmitError('Missing LGTM from an OWNER for: %s' %
645 ','.join(missing_files))] 645 ','.join(missing_files))]
646 return [] 646 return []
647 elif input_api.change.tags.get('R'): 647 elif input_api.change.tags.get('R'):
(...skipping 20 matching lines...) Expand all
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['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 | « git_cl_hooks.py ('k') | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698