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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 Args: | 83 Args: |
84 output_stream: Where to write | 84 output_stream: Where to write |
85 | 85 |
86 Returns: | 86 Returns: |
87 True if execution may continue, False otherwise. | 87 True if execution may continue, False otherwise. |
88 """ | 88 """ |
89 output_stream.write(self._message) | 89 output_stream.write(self._message) |
90 output_stream.write('\n') | 90 output_stream.write('\n') |
91 for item in self._items: | 91 for item in self._items: |
92 output_stream.write(' %s\n' % item) | 92 output_stream.write(' %s\n' % str(item)) |
93 if self._long_text: | 93 if self._long_text: |
94 output_stream.write('\n***************\n%s\n***************\n' % | 94 output_stream.write('\n***************\n%s\n***************\n' % |
95 self._long_text) | 95 self._long_text) |
96 | 96 |
97 if self.ShouldPrompt() and may_prompt: | 97 if self.ShouldPrompt() and may_prompt: |
98 output_stream.write('Are you sure you want to continue? (y/N): ') | 98 output_stream.write('Are you sure you want to continue? (y/N): ') |
99 response = input_stream.readline() | 99 response = input_stream.readline() |
100 if response.strip().lower() != 'y': | 100 if response.strip().lower() != 'y': |
101 return False | 101 return False |
102 | 102 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 428 |
429 def OldFileTempPath(self): | 429 def OldFileTempPath(self): |
430 """Returns the path on local disk where the old contents resides. | 430 """Returns the path on local disk where the old contents resides. |
431 | 431 |
432 The old version is the file in depot, i.e. the "left hand side". | 432 The old version is the file in depot, i.e. the "left hand side". |
433 This is a read-only cached copy of the old contents. *DO NOT* try to | 433 This is a read-only cached copy of the old contents. *DO NOT* try to |
434 modify this file. | 434 modify this file. |
435 """ | 435 """ |
436 raise NotImplementedError() # Implement if/when needed. | 436 raise NotImplementedError() # Implement if/when needed. |
437 | 437 |
| 438 def __str__(self): |
| 439 return self.LocalPath() |
| 440 |
438 | 441 |
439 class SvnAffectedFile(AffectedFile): | 442 class SvnAffectedFile(AffectedFile): |
440 """Representation of a file in a change out of a Subversion checkout.""" | 443 """Representation of a file in a change out of a Subversion checkout.""" |
441 | 444 |
442 def __init__(self, *args, **kwargs): | 445 def __init__(self, *args, **kwargs): |
443 AffectedFile.__init__(self, *args, **kwargs) | 446 AffectedFile.__init__(self, *args, **kwargs) |
444 self._server_path = None | 447 self._server_path = None |
445 self._is_text_file = None | 448 self._is_text_file = None |
446 self.scm = 'svn' | 449 self.scm = 'svn' |
447 | 450 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 options.commit, | 811 options.commit, |
809 options.verbose, | 812 options.verbose, |
810 sys.stdout, | 813 sys.stdout, |
811 sys.stdin, | 814 sys.stdin, |
812 None, | 815 None, |
813 False) | 816 False) |
814 | 817 |
815 | 818 |
816 if __name__ == '__main__': | 819 if __name__ == '__main__': |
817 sys.exit(Main(sys.argv)) | 820 sys.exit(Main(sys.argv)) |
OLD | NEW |