OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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.2' | 9 __version__ = '1.2' |
10 | 10 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 # Matches key/value (or "tag") lines in changelist descriptions. | 437 # Matches key/value (or "tag") lines in changelist descriptions. |
438 _tag_line_re = re.compile( | 438 _tag_line_re = re.compile( |
439 '^\s*(?P<key>[A-Z][A-Z_0-9]*)\s*=\s*(?P<value>.*?)\s*$') | 439 '^\s*(?P<key>[A-Z][A-Z_0-9]*)\s*=\s*(?P<value>.*?)\s*$') |
440 | 440 |
441 def __init__(self, change_info, repository_root=''): | 441 def __init__(self, change_info, repository_root=''): |
442 # Do not keep a reference to the original change_info. | 442 # Do not keep a reference to the original change_info. |
443 self._name = change_info.name | 443 self._name = change_info.name |
444 self._full_description = change_info.description | 444 self._full_description = change_info.description |
445 self._repository_root = repository_root | 445 self._repository_root = repository_root |
| 446 self.issue = change_info.issue |
| 447 self.patchset = change_info.patchset |
446 | 448 |
447 # From the description text, build up a dictionary of key/value pairs | 449 # From the description text, build up a dictionary of key/value pairs |
448 # plus the description minus all key/value or "tag" lines. | 450 # plus the description minus all key/value or "tag" lines. |
449 self._description_without_tags = [] | 451 self._description_without_tags = [] |
450 self.tags = {} | 452 self.tags = {} |
451 for line in change_info.description.splitlines(): | 453 for line in change_info.description.splitlines(): |
452 m = self._tag_line_re.match(line) | 454 m = self._tag_line_re.match(line) |
453 if m: | 455 if m: |
454 self.tags[m.group('key')] = m.group('value') | 456 self.tags[m.group('key')] = m.group('value') |
455 else: | 457 else: |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files), | 745 return not DoPresubmitChecks(gcl.ChangeInfo(name='temp', files=files), |
744 options.commit, | 746 options.commit, |
745 options.verbose, | 747 options.verbose, |
746 sys.stdout, | 748 sys.stdout, |
747 sys.stdin, | 749 sys.stdin, |
748 default_presubmit=None) | 750 default_presubmit=None) |
749 | 751 |
750 | 752 |
751 if __name__ == '__main__': | 753 if __name__ == '__main__': |
752 sys.exit(Main(sys.argv)) | 754 sys.exit(Main(sys.argv)) |
OLD | NEW |