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

Side by Side Diff: presubmit_support.py

Issue 6657028: Actually check Rietveld for LGTMs in CheckOwners() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: rename is_tbr to tbr, remove optional email_regexp param from CheckOwners() 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 | « presubmit_canned_checks.py ('k') | tests/presubmit_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 """Enables directory-specific presubmit checks to run at upload and/or commit. 6 """Enables directory-specific presubmit checks to run at upload and/or commit.
7 """ 7 """
8 8
9 __version__ = '1.3.5' 9 __version__ = '1.3.5'
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 r".*\bRelease[\\\/].*", 220 r".*\bRelease[\\\/].*",
221 r".*\bxcodebuild[\\\/].*", 221 r".*\bxcodebuild[\\\/].*",
222 r".*\bsconsbuild[\\\/].*", 222 r".*\bsconsbuild[\\\/].*",
223 # All caps files like README and LICENCE. 223 # All caps files like README and LICENCE.
224 r".*\b[A-Z0-9_]{2,}$", 224 r".*\b[A-Z0-9_]{2,}$",
225 # SCM (can happen in dual SCM configuration). (Slightly over aggressive) 225 # SCM (can happen in dual SCM configuration). (Slightly over aggressive)
226 r"(|.*[\\\/])\.git[\\\/].*", 226 r"(|.*[\\\/])\.git[\\\/].*",
227 r"(|.*[\\\/])\.svn[\\\/].*", 227 r"(|.*[\\\/])\.svn[\\\/].*",
228 ) 228 )
229 229
230 def __init__(self, change, presubmit_path, is_committing): 230 # TODO(dpranke): Update callers to pass in tbr, host_url, remove
231 # default arguments.
232 def __init__(self, change, presubmit_path, is_committing, tbr=False,
233 host_url='http://codereview.chromium.org'):
231 """Builds an InputApi object. 234 """Builds an InputApi object.
232 235
233 Args: 236 Args:
234 change: A presubmit.Change object. 237 change: A presubmit.Change object.
235 presubmit_path: The path to the presubmit script being processed. 238 presubmit_path: The path to the presubmit script being processed.
236 is_committing: True if the change is about to be committed. 239 is_committing: True if the change is about to be committed.
237 """ 240 """
238 # Version number of the presubmit_support script. 241 # Version number of the presubmit_support script.
239 self.version = [int(x) for x in __version__.split('.')] 242 self.version = [int(x) for x in __version__.split('.')]
240 self.change = change 243 self.change = change
244 self.host_url = host_url
241 self.is_committing = is_committing 245 self.is_committing = is_committing
246 self.tbr = tbr
242 247
243 # We expose various modules and functions as attributes of the input_api 248 # We expose various modules and functions as attributes of the input_api
244 # so that presubmit scripts don't have to import them. 249 # so that presubmit scripts don't have to import them.
245 self.basename = os.path.basename 250 self.basename = os.path.basename
246 self.cPickle = cPickle 251 self.cPickle = cPickle
247 self.cStringIO = cStringIO 252 self.cStringIO = cStringIO
248 self.json = json 253 self.json = json
249 self.os_path = os.path 254 self.os_path = os.path
250 self.pickle = pickle 255 self.pickle = pickle
251 self.marshal = marshal 256 self.marshal = marshal
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 651
647 def __init__(self, name, description, local_root, files, issue, patchset): 652 def __init__(self, name, description, local_root, files, issue, patchset):
648 if files is None: 653 if files is None:
649 files = [] 654 files = []
650 self._name = name 655 self._name = name
651 self._full_description = description 656 self._full_description = description
652 # Convert root into an absolute path. 657 # Convert root into an absolute path.
653 self._local_root = os.path.abspath(local_root) 658 self._local_root = os.path.abspath(local_root)
654 self.issue = issue 659 self.issue = issue
655 self.patchset = patchset 660 self.patchset = patchset
656
657 # TODO(dpranke): implement - get from the patchset?
658 self.approvers = set()
659
660 self.scm = '' 661 self.scm = ''
661 662
662 # From the description text, build up a dictionary of key/value pairs 663 # From the description text, build up a dictionary of key/value pairs
663 # plus the description minus all key/value or "tag" lines. 664 # plus the description minus all key/value or "tag" lines.
664 description_without_tags = [] 665 description_without_tags = []
665 self.tags = {} 666 self.tags = {}
666 for line in self._full_description.splitlines(): 667 for line in self._full_description.splitlines():
667 m = self._TAG_LINE_RE.match(line) 668 m = self._TAG_LINE_RE.match(line)
668 if m: 669 if m:
669 self.tags[m.group('key')] = m.group('value') 670 self.tags[m.group('key')] = m.group('value')
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 options.commit, 1185 options.commit,
1185 options.verbose, 1186 options.verbose,
1186 sys.stdout, 1187 sys.stdout,
1187 sys.stdin, 1188 sys.stdin,
1188 options.default_presubmit, 1189 options.default_presubmit,
1189 options.may_prompt) 1190 options.may_prompt)
1190 1191
1191 1192
1192 if __name__ == '__main__': 1193 if __name__ == '__main__':
1193 sys.exit(Main(sys.argv)) 1194 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698