| 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 import optparse | 6 import optparse |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 # any '\r's. | 125 # any '\r's. |
| 126 return ''.join([l.replace('\r','') for l in svn_log[3:-1]]) | 126 return ''.join([l.replace('\r','') for l in svn_log[3:-1]]) |
| 127 | 127 |
| 128 def getSVNVersionInfo(): | 128 def getSVNVersionInfo(): |
| 129 """Extract version information from SVN""" | 129 """Extract version information from SVN""" |
| 130 svn_info = gclient_utils.Popen(['svn', '--version'], | 130 svn_info = gclient_utils.Popen(['svn', '--version'], |
| 131 stdout=subprocess.PIPE, | 131 stdout=subprocess.PIPE, |
| 132 stderr=subprocess.PIPE).stdout.readlines() | 132 stderr=subprocess.PIPE).stdout.readlines() |
| 133 info = {} | 133 info = {} |
| 134 for line in svn_info: | 134 for line in svn_info: |
| 135 match = re.search(r"svn, version ((\d+)\.(\d+)\.(\d+)) \(r(\d+)\)", line) | 135 match = re.search(r"svn, version ((\d+)\.(\d+)\.(\d+))", line) |
| 136 if match: | 136 if match: |
| 137 info['version'] = match.group(1) | 137 info['version'] = match.group(1) |
| 138 info['major'] = int(match.group(2)) | 138 info['major'] = int(match.group(2)) |
| 139 info['minor'] = int(match.group(3)) | 139 info['minor'] = int(match.group(3)) |
| 140 info['patch'] = int(match.group(4)) | 140 info['patch'] = int(match.group(4)) |
| 141 info['revision'] = match.group(5) | |
| 142 return info | 141 return info |
| 143 | 142 |
| 144 return None | 143 return None |
| 145 | 144 |
| 146 def isMinimumSVNVersion(major, minor, patch=0): | 145 def isMinimumSVNVersion(major, minor, patch=0): |
| 147 """Test for minimum SVN version""" | 146 """Test for minimum SVN version""" |
| 148 return _isMinimumSVNVersion(getSVNVersionInfo(), major, minor, patch) | 147 return _isMinimumSVNVersion(getSVNVersionInfo(), major, minor, patch) |
| 149 | 148 |
| 150 def _isMinimumSVNVersion(version, major, minor, patch=0): | 149 def _isMinimumSVNVersion(version, major, minor, patch=0): |
| 151 """Test for minimum SVN version, internal method""" | 150 """Test for minimum SVN version, internal method""" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 551 |
| 553 if options.local and (options.revert or options.branch): | 552 if options.local and (options.revert or options.branch): |
| 554 option_parser.error("--local cannot be used with --revert or --branch") | 553 option_parser.error("--local cannot be used with --revert or --branch") |
| 555 return 1 | 554 return 1 |
| 556 | 555 |
| 557 return drover(options, args) | 556 return drover(options, args) |
| 558 | 557 |
| 559 | 558 |
| 560 if __name__ == "__main__": | 559 if __name__ == "__main__": |
| 561 sys.exit(main()) | 560 sys.exit(main()) |
| OLD | NEW |