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

Side by Side Diff: presubmit_support.py

Issue 8203002: Add assert to make sure the files argument type is valid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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/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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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.6.1' 9 __version__ = '1.6.1'
10 10
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 m = self._TAG_LINE_RE.match(line) 683 m = self._TAG_LINE_RE.match(line)
684 if m: 684 if m:
685 self.tags[m.group('key')] = m.group('value') 685 self.tags[m.group('key')] = m.group('value')
686 else: 686 else:
687 description_without_tags.append(line) 687 description_without_tags.append(line)
688 688
689 # Change back to text and remove whitespace at end. 689 # Change back to text and remove whitespace at end.
690 self._description_without_tags = ( 690 self._description_without_tags = (
691 '\n'.join(description_without_tags).rstrip()) 691 '\n'.join(description_without_tags).rstrip())
692 692
693 assert all(
694 (isinstance(f, (list, tuple)) and len(f) == 2) for f in files), files
695
693 self._affected_files = [ 696 self._affected_files = [
694 self._AFFECTED_FILES(info[1], info[0].strip(), self._local_root) 697 self._AFFECTED_FILES(info[1], info[0].strip(), self._local_root)
695 for info in files 698 for info in files
696 ] 699 ]
697 700
698 def Name(self): 701 def Name(self):
699 """Returns the change name.""" 702 """Returns the change name."""
700 return self._name 703 return self._name
701 704
702 def DescriptionText(self): 705 def DescriptionText(self):
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 except PresubmitFailure, e: 1255 except PresubmitFailure, e:
1253 print >> sys.stderr, e 1256 print >> sys.stderr, e
1254 print >> sys.stderr, 'Maybe your depot_tools is out of date?' 1257 print >> sys.stderr, 'Maybe your depot_tools is out of date?'
1255 print >> sys.stderr, 'If all fails, contact maruel@' 1258 print >> sys.stderr, 'If all fails, contact maruel@'
1256 return 2 1259 return 2
1257 1260
1258 1261
1259 if __name__ == '__main__': 1262 if __name__ == '__main__':
1260 fix_encoding.fix_encoding() 1263 fix_encoding.fix_encoding()
1261 sys.exit(Main(None)) 1264 sys.exit(Main(None))
OLDNEW
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698