| 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 """Gclient-specific SCM-specific operations.""" | 5 """Gclient-specific SCM-specific operations.""" |
| 6 | 6 |
| 7 from __future__ import print_function | 7 from __future__ import print_function |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if not command in dir(self): | 154 if not command in dir(self): |
| 155 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( | 155 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( |
| 156 command, self.__class__.__name__)) | 156 command, self.__class__.__name__)) |
| 157 | 157 |
| 158 return getattr(self, command)(options, args, file_list) | 158 return getattr(self, command)(options, args, file_list) |
| 159 | 159 |
| 160 def GetActualRemoteURL(self, options): | 160 def GetActualRemoteURL(self, options): |
| 161 """Attempt to determine the remote URL for this SCMWrapper.""" | 161 """Attempt to determine the remote URL for this SCMWrapper.""" |
| 162 # Git | 162 # Git |
| 163 if os.path.exists(os.path.join(self.checkout_path, '.git')): | 163 if os.path.exists(os.path.join(self.checkout_path, '.git')): |
| 164 actual_remote_url = shlex.split(self._Capture( | 164 actual_remote_url = shlex.split(scm.GIT.Capture( |
| 165 ['config', '--local', '--get-regexp', r'remote.*.url'], | 165 ['config', '--local', '--get-regexp', r'remote.*.url'], |
| 166 cwd=self.checkout_path))[1] | 166 cwd=self.checkout_path))[1] |
| 167 | 167 |
| 168 # If a cache_dir is used, obtain the actual remote URL from the cache. | 168 # If a cache_dir is used, obtain the actual remote URL from the cache. |
| 169 if getattr(self, 'cache_dir', None): | 169 if getattr(self, 'cache_dir', None): |
| 170 url, _ = gclient_utils.SplitUrlRevision(self.url) | 170 url, _ = gclient_utils.SplitUrlRevision(self.url) |
| 171 mirror = git_cache.Mirror(url) | 171 mirror = git_cache.Mirror(url) |
| 172 if (mirror.exists() and mirror.mirror_path.replace('\\', '/') == | 172 if (mirror.exists() and mirror.mirror_path.replace('\\', '/') == |
| 173 actual_remote_url.replace('\\', '/')): | 173 actual_remote_url.replace('\\', '/')): |
| 174 actual_remote_url = shlex.split(self._Capture( | 174 actual_remote_url = shlex.split(scm.GIT.Capture( |
| 175 ['config', '--local', '--get-regexp', r'remote.*.url'], | 175 ['config', '--local', '--get-regexp', r'remote.*.url'], |
| 176 cwd=mirror.mirror_path))[1] | 176 cwd=mirror.mirror_path))[1] |
| 177 return actual_remote_url | 177 return actual_remote_url |
| 178 | 178 |
| 179 # Svn | 179 # Svn |
| 180 if os.path.exists(os.path.join(self.checkout_path, '.svn')): | 180 if os.path.exists(os.path.join(self.checkout_path, '.svn')): |
| 181 return scm.SVN.CaptureLocalInfo([], self.checkout_path)['URL'] | 181 return scm.SVN.CaptureLocalInfo([], self.checkout_path)['URL'] |
| 182 return None | 182 return None |
| 183 | 183 |
| 184 def DoesRemoteURLMatch(self, options): | 184 def DoesRemoteURLMatch(self, options): |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 new_command.append('--force') | 1454 new_command.append('--force') |
| 1455 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1455 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1456 new_command.extend(('--accept', 'theirs-conflict')) | 1456 new_command.extend(('--accept', 'theirs-conflict')) |
| 1457 elif options.manually_grab_svn_rev: | 1457 elif options.manually_grab_svn_rev: |
| 1458 new_command.append('--force') | 1458 new_command.append('--force') |
| 1459 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1459 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1460 new_command.extend(('--accept', 'postpone')) | 1460 new_command.extend(('--accept', 'postpone')) |
| 1461 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1461 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1462 new_command.extend(('--accept', 'postpone')) | 1462 new_command.extend(('--accept', 'postpone')) |
| 1463 return new_command | 1463 return new_command |
| OLD | NEW |