| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 self._is_text_file = False | 551 self._is_text_file = False |
| 552 elif self.IsDirectory(): | 552 elif self.IsDirectory(): |
| 553 self._is_text_file = False | 553 self._is_text_file = False |
| 554 else: | 554 else: |
| 555 mime_type = scm.SVN.GetFileProperty(self.AbsoluteLocalPath(), | 555 mime_type = scm.SVN.GetFileProperty(self.AbsoluteLocalPath(), |
| 556 'svn:mime-type') | 556 'svn:mime-type') |
| 557 self._is_text_file = (not mime_type or mime_type.startswith('text/')) | 557 self._is_text_file = (not mime_type or mime_type.startswith('text/')) |
| 558 return self._is_text_file | 558 return self._is_text_file |
| 559 | 559 |
| 560 def GenerateScmDiff(self): | 560 def GenerateScmDiff(self): |
| 561 return scm.SVN.GenerateDiff(self.AbsoluteLocalPath()) | 561 return scm.SVN.GenerateDiff([self.AbsoluteLocalPath()]) |
| 562 |
| 562 | 563 |
| 563 class GitAffectedFile(AffectedFile): | 564 class GitAffectedFile(AffectedFile): |
| 564 """Representation of a file in a change out of a git checkout.""" | 565 """Representation of a file in a change out of a git checkout.""" |
| 565 # Method 'NNN' is abstract in class 'NNN' but is not overridden | 566 # Method 'NNN' is abstract in class 'NNN' but is not overridden |
| 566 # pylint: disable=W0223 | 567 # pylint: disable=W0223 |
| 567 | 568 |
| 568 def __init__(self, *args, **kwargs): | 569 def __init__(self, *args, **kwargs): |
| 569 AffectedFile.__init__(self, *args, **kwargs) | 570 AffectedFile.__init__(self, *args, **kwargs) |
| 570 self._server_path = None | 571 self._server_path = None |
| 571 self._is_text_file = None | 572 self._is_text_file = None |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 options.commit, | 1158 options.commit, |
| 1158 options.verbose, | 1159 options.verbose, |
| 1159 sys.stdout, | 1160 sys.stdout, |
| 1160 sys.stdin, | 1161 sys.stdin, |
| 1161 options.default_presubmit, | 1162 options.default_presubmit, |
| 1162 options.may_prompt) | 1163 options.may_prompt) |
| 1163 | 1164 |
| 1164 | 1165 |
| 1165 if __name__ == '__main__': | 1166 if __name__ == '__main__': |
| 1166 sys.exit(Main(sys.argv)) | 1167 sys.exit(Main(sys.argv)) |
| OLD | NEW |