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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 # querying subversion, especially on Windows. | 462 # querying subversion, especially on Windows. |
463 self._is_directory = os.path.isdir(path) | 463 self._is_directory = os.path.isdir(path) |
464 else: | 464 else: |
465 self._is_directory = gclient.CaptureSVNInfo( | 465 self._is_directory = gclient.CaptureSVNInfo( |
466 path).get('Node Kind') in ('dir', 'directory') | 466 path).get('Node Kind') in ('dir', 'directory') |
467 return self._is_directory | 467 return self._is_directory |
468 | 468 |
469 def Property(self, property_name): | 469 def Property(self, property_name): |
470 if not property_name in self._properties: | 470 if not property_name in self._properties: |
471 self._properties[property_name] = gcl.GetSVNFileProperty( | 471 self._properties[property_name] = gcl.GetSVNFileProperty( |
472 self.AbsoluteLocalPath(), property_name) | 472 self.AbsoluteLocalPath(), property_name).rstrip() |
473 return self._properties[property_name] | 473 return self._properties[property_name] |
474 | 474 |
475 def IsTextFile(self): | 475 def IsTextFile(self): |
476 if self._is_text_file is None: | 476 if self._is_text_file is None: |
477 if self.Action() == 'D': | 477 if self.Action() == 'D': |
478 # A deleted file is not a text file. | 478 # A deleted file is not a text file. |
479 self._is_text_file = False | 479 self._is_text_file = False |
480 elif self.IsDirectory(): | 480 elif self.IsDirectory(): |
481 self._is_text_file = False | 481 self._is_text_file = False |
482 else: | 482 else: |
(...skipping 328 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 |