| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
| 6 | 6 |
| 7 import cStringIO | 7 import cStringIO |
| 8 import glob | 8 import glob |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 try: | 997 try: |
| 998 SVN.Capture(['info', url], cwd=None) | 998 SVN.Capture(['info', url], cwd=None) |
| 999 return True | 999 return True |
| 1000 except subprocess2.CalledProcessError: | 1000 except subprocess2.CalledProcessError: |
| 1001 return False | 1001 return False |
| 1002 | 1002 |
| 1003 @classmethod | 1003 @classmethod |
| 1004 def AssertVersion(cls, min_version): | 1004 def AssertVersion(cls, min_version): |
| 1005 """Asserts svn's version is at least min_version.""" | 1005 """Asserts svn's version is at least min_version.""" |
| 1006 if cls.current_version is None: | 1006 if cls.current_version is None: |
| 1007 cls.current_version = cls.Capture(['--version'], None).split()[2] | 1007 cls.current_version = cls.Capture(['--version', '--quiet'], None) |
| 1008 current_version_list = map(only_int, cls.current_version.split('.')) | 1008 current_version_list = map(only_int, cls.current_version.split('.')) |
| 1009 for min_ver in map(int, min_version.split('.')): | 1009 for min_ver in map(int, min_version.split('.')): |
| 1010 ver = current_version_list.pop(0) | 1010 ver = current_version_list.pop(0) |
| 1011 if ver < min_ver: | 1011 if ver < min_ver: |
| 1012 return (False, cls.current_version) | 1012 return (False, cls.current_version) |
| 1013 elif ver > min_ver: | 1013 elif ver > min_ver: |
| 1014 return (True, cls.current_version) | 1014 return (True, cls.current_version) |
| 1015 return (True, cls.current_version) | 1015 return (True, cls.current_version) |
| 1016 | 1016 |
| 1017 @staticmethod | 1017 @staticmethod |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 # revert, like for properties. | 1063 # revert, like for properties. |
| 1064 if not os.path.isdir(cwd): | 1064 if not os.path.isdir(cwd): |
| 1065 # '.' was deleted. It's not worth continuing. | 1065 # '.' was deleted. It's not worth continuing. |
| 1066 return | 1066 return |
| 1067 try: | 1067 try: |
| 1068 SVN.Capture(['revert', file_status[1]], cwd=cwd) | 1068 SVN.Capture(['revert', file_status[1]], cwd=cwd) |
| 1069 except subprocess2.CalledProcessError: | 1069 except subprocess2.CalledProcessError: |
| 1070 if not os.path.exists(file_path): | 1070 if not os.path.exists(file_path): |
| 1071 continue | 1071 continue |
| 1072 raise | 1072 raise |
| OLD | NEW |