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 import logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return None | 151 return None |
152 | 152 |
153 def DoesRemoteURLMatch(self): | 153 def DoesRemoteURLMatch(self): |
154 """Determine whether the remote URL of this checkout is the expected URL.""" | 154 """Determine whether the remote URL of this checkout is the expected URL.""" |
155 if not os.path.exists(self.checkout_path): | 155 if not os.path.exists(self.checkout_path): |
156 # A checkout which doesn't exist can't be broken. | 156 # A checkout which doesn't exist can't be broken. |
157 return True | 157 return True |
158 | 158 |
159 actual_remote_url = self.GetActualRemoteURL() | 159 actual_remote_url = self.GetActualRemoteURL() |
160 if actual_remote_url: | 160 if actual_remote_url: |
161 return actual_remote_url.rstrip('/') == self.url.rstrip('/') | 161 return (gclient_utils.SplitUrlRevision(actual_remote_url)[0].rstrip('/') |
| 162 == gclient_utils.SplitUrlRevision(self.url)[0].rstrip('/')) |
162 else: | 163 else: |
163 # This may occur if the self.checkout_path exists but does not contain a | 164 # This may occur if the self.checkout_path exists but does not contain a |
164 # valid git or svn checkout. | 165 # valid git or svn checkout. |
165 return False | 166 return False |
166 | 167 |
167 | 168 |
168 class GitWrapper(SCMWrapper): | 169 class GitWrapper(SCMWrapper): |
169 """Wrapper for Git""" | 170 """Wrapper for Git""" |
170 name = 'git' | 171 name = 'git' |
171 remote = 'origin' | 172 remote = 'origin' |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 new_command.append('--force') | 1428 new_command.append('--force') |
1428 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1429 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1429 new_command.extend(('--accept', 'theirs-conflict')) | 1430 new_command.extend(('--accept', 'theirs-conflict')) |
1430 elif options.manually_grab_svn_rev: | 1431 elif options.manually_grab_svn_rev: |
1431 new_command.append('--force') | 1432 new_command.append('--force') |
1432 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1433 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1433 new_command.extend(('--accept', 'postpone')) | 1434 new_command.extend(('--accept', 'postpone')) |
1434 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1435 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1435 new_command.extend(('--accept', 'postpone')) | 1436 new_command.extend(('--accept', 'postpone')) |
1436 return new_command | 1437 return new_command |
OLD | NEW |