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.3.5' | 9 __version__ = '1.3.5' |
10 | 10 |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 self._name = name | 581 self._name = name |
582 self._full_description = description | 582 self._full_description = description |
583 # Convert root into an absolute path. | 583 # Convert root into an absolute path. |
584 self._local_root = os.path.abspath(local_root) | 584 self._local_root = os.path.abspath(local_root) |
585 self.issue = issue | 585 self.issue = issue |
586 self.patchset = patchset | 586 self.patchset = patchset |
587 self.scm = '' | 587 self.scm = '' |
588 | 588 |
589 # From the description text, build up a dictionary of key/value pairs | 589 # From the description text, build up a dictionary of key/value pairs |
590 # plus the description minus all key/value or "tag" lines. | 590 # plus the description minus all key/value or "tag" lines. |
591 self._description_without_tags = [] | 591 description_without_tags = [] |
592 self.tags = {} | 592 self.tags = {} |
593 for line in self._full_description.splitlines(): | 593 for line in self._full_description.splitlines(): |
594 m = self._TAG_LINE_RE.match(line) | 594 m = self._TAG_LINE_RE.match(line) |
595 if m: | 595 if m: |
596 self.tags[m.group('key')] = m.group('value') | 596 self.tags[m.group('key')] = m.group('value') |
597 else: | 597 else: |
598 self._description_without_tags.append(line) | 598 description_without_tags.append(line) |
599 | 599 |
600 # Change back to text and remove whitespace at end. | 600 # Change back to text and remove whitespace at end. |
601 self._description_without_tags = '\n'.join(self._description_without_tags) | 601 self._description_without_tags = ( |
602 self._description_without_tags = self._description_without_tags.rstrip() | 602 '\n'.join(description_without_tags).rstrip()) |
603 | 603 |
604 self._affected_files = [ | 604 self._affected_files = [ |
605 self._AFFECTED_FILES(info[1], info[0].strip(), self._local_root) | 605 self._AFFECTED_FILES(info[1], info[0].strip(), self._local_root) |
606 for info in files | 606 for info in files |
607 ] | 607 ] |
608 | 608 |
609 def Name(self): | 609 def Name(self): |
610 """Returns the change name.""" | 610 """Returns the change name.""" |
611 return self._name | 611 return self._name |
612 | 612 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 options.commit, | 1087 options.commit, |
1088 options.verbose, | 1088 options.verbose, |
1089 sys.stdout, | 1089 sys.stdout, |
1090 sys.stdin, | 1090 sys.stdin, |
1091 options.default_presubmit, | 1091 options.default_presubmit, |
1092 options.may_prompt) | 1092 options.may_prompt) |
1093 | 1093 |
1094 | 1094 |
1095 if __name__ == '__main__': | 1095 if __name__ == '__main__': |
1096 sys.exit(Main(sys.argv)) | 1096 sys.exit(Main(sys.argv)) |
OLD | NEW |