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.2' | 9 __version__ = '1.3.2' |
10 | 10 |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 | 522 |
523 # Change back to text and remove whitespace at end. | 523 # Change back to text and remove whitespace at end. |
524 self._description_without_tags = '\n'.join(self._description_without_tags) | 524 self._description_without_tags = '\n'.join(self._description_without_tags) |
525 self._description_without_tags = self._description_without_tags.rstrip() | 525 self._description_without_tags = self._description_without_tags.rstrip() |
526 | 526 |
527 self._affected_files = [ | 527 self._affected_files = [ |
528 SvnAffectedFile(info[1], info[0].strip(), repository_root) | 528 SvnAffectedFile(info[1], info[0].strip(), repository_root) |
529 for info in change_info.files | 529 for info in change_info.files |
530 ] | 530 ] |
531 | 531 |
532 def Change(self): | 532 def Name(self): |
533 """Returns the change name.""" | 533 """Returns the change name.""" |
534 return self._name | 534 return self._name |
535 | 535 |
536 def DescriptionText(self): | 536 def DescriptionText(self): |
537 """Returns the user-entered changelist description, minus tags. | 537 """Returns the user-entered changelist description, minus tags. |
538 | 538 |
539 Any line in the user-provided description starting with e.g. "FOO=" | 539 Any line in the user-provided description starting with e.g. "FOO=" |
540 (whitespace permitted before and around) is considered a tag line. Such | 540 (whitespace permitted before and around) is considered a tag line. Such |
541 lines are stripped out of the description this function returns. | 541 lines are stripped out of the description this function returns. |
542 """ | 542 """ |
543 return self._description_without_tags | 543 return self._description_without_tags |
544 | 544 |
545 def FullDescriptionText(self): | 545 def FullDescriptionText(self): |
546 """Returns the complete changelist description including tags.""" | 546 """Returns the complete changelist description including tags.""" |
547 return self._full_description | 547 return self._full_description |
548 | 548 |
549 def RepositoryRoot(self): | 549 def RepositoryRoot(self): |
550 """Returns the repository root for this change, as an absolute path.""" | 550 """Returns the repository (checkout) root directory for this change, |
| 551 as an absolute path. |
| 552 """ |
551 return self._repository_root | 553 return self._repository_root |
552 | 554 |
553 def __getattr__(self, attr): | 555 def __getattr__(self, attr): |
554 """Return keys directly as attributes on the object. | 556 """Return tags directly as attributes on the object.""" |
555 | 557 if not re.match(r"^[A-Z_]*$", attr): |
556 You may use a friendly name (from SPECIAL_KEYS) or the actual name of | 558 raise AttributeError(self, attr) |
557 the key. | |
558 """ | |
559 return self.tags.get(attr) | 559 return self.tags.get(attr) |
560 | 560 |
561 def AffectedFiles(self, include_dirs=False, include_deletes=True): | 561 def AffectedFiles(self, include_dirs=False, include_deletes=True): |
562 """Returns a list of AffectedFile instances for all files in the change. | 562 """Returns a list of AffectedFile instances for all files in the change. |
563 | 563 |
564 Args: | 564 Args: |
565 include_deletes: If false, deleted files will be filtered out. | 565 include_deletes: If false, deleted files will be filtered out. |
566 include_dirs: True to include directories in the list | 566 include_dirs: True to include directories in the list |
567 | 567 |
568 Returns: | 568 Returns: |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 options.commit, | 811 options.commit, |
812 options.verbose, | 812 options.verbose, |
813 sys.stdout, | 813 sys.stdout, |
814 sys.stdin, | 814 sys.stdin, |
815 None, | 815 None, |
816 False) | 816 False) |
817 | 817 |
818 | 818 |
819 if __name__ == '__main__': | 819 if __name__ == '__main__': |
820 sys.exit(Main(sys.argv)) | 820 sys.exit(Main(sys.argv)) |
OLD | NEW |