| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env 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 """ | 6 """ |
| 7 lastchange.py -- Chromium revision fetching utility. | 7 lastchange.py -- Chromium revision fetching utility. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import optparse | 10 import optparse |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 Errors are swallowed. | 54 Errors are swallowed. |
| 55 | 55 |
| 56 Returns: | 56 Returns: |
| 57 a VersionInfo object or None on error. | 57 a VersionInfo object or None on error. |
| 58 """ | 58 """ |
| 59 try: | 59 try: |
| 60 proc = subprocess.Popen(['svn', 'info'], | 60 proc = subprocess.Popen(['svn', 'info'], |
| 61 stdout=subprocess.PIPE, | 61 stdout=subprocess.PIPE, |
| 62 stderr=subprocess.PIPE, | 62 stderr=subprocess.PIPE, |
| 63 cwd=directory) | 63 cwd=directory, |
| 64 shell=(sys.platform=='win32')) |
| 64 except OSError: | 65 except OSError: |
| 65 # command is apparently either not installed or not executable. | 66 # command is apparently either not installed or not executable. |
| 66 return None | 67 return None |
| 67 if not proc: | 68 if not proc: |
| 68 return None | 69 return None |
| 69 | 70 |
| 70 attrs = {} | 71 attrs = {} |
| 71 for line in proc.stdout: | 72 for line in proc.stdout: |
| 72 line = line.strip() | 73 line = line.strip() |
| 73 if not line: | 74 if not line: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if out_file: | 149 if out_file: |
| 149 WriteIfChanged(out_file, contents) | 150 WriteIfChanged(out_file, contents) |
| 150 else: | 151 else: |
| 151 sys.stdout.write(contents) | 152 sys.stdout.write(contents) |
| 152 | 153 |
| 153 return 0 | 154 return 0 |
| 154 | 155 |
| 155 | 156 |
| 156 if __name__ == '__main__': | 157 if __name__ == '__main__': |
| 157 sys.exit(main()) | 158 sys.exit(main()) |
| OLD | NEW |