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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if revision.startswith('refs/heads/'): | 212 if revision.startswith('refs/heads/'): |
213 rev_type = "branch" | 213 rev_type = "branch" |
214 elif revision.startswith('origin/'): | 214 elif revision.startswith('origin/'): |
215 # For compatability with old naming, translate 'origin' to 'refs/heads' | 215 # For compatability with old naming, translate 'origin' to 'refs/heads' |
216 revision = revision.replace('origin/', 'refs/heads/') | 216 revision = revision.replace('origin/', 'refs/heads/') |
217 rev_type = "branch" | 217 rev_type = "branch" |
218 else: | 218 else: |
219 # hash is also a tag, only make a distinction at checkout | 219 # hash is also a tag, only make a distinction at checkout |
220 rev_type = "hash" | 220 rev_type = "hash" |
221 | 221 |
222 if not os.path.exists(self.checkout_path): | 222 if not os.path.exists(self.checkout_path) or ( |
| 223 os.path.isdir(self.checkout_path) and |
| 224 not os.listdir(self.checkout_path)): |
223 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path)) | 225 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path)) |
224 self._Clone(revision, url, options) | 226 self._Clone(revision, url, options) |
225 files = self._Capture(['ls-files']).splitlines() | 227 files = self._Capture(['ls-files']).splitlines() |
226 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) | 228 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
227 if not verbose: | 229 if not verbose: |
228 # Make the output a little prettier. It's nice to have some whitespace | 230 # Make the output a little prettier. It's nice to have some whitespace |
229 # between projects when cloning. | 231 # between projects when cloning. |
230 print('') | 232 print('') |
231 return | 233 return |
232 | 234 |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 new_command.append('--force') | 1129 new_command.append('--force') |
1128 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1130 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1129 new_command.extend(('--accept', 'theirs-conflict')) | 1131 new_command.extend(('--accept', 'theirs-conflict')) |
1130 elif options.manually_grab_svn_rev: | 1132 elif options.manually_grab_svn_rev: |
1131 new_command.append('--force') | 1133 new_command.append('--force') |
1132 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1134 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1133 new_command.extend(('--accept', 'postpone')) | 1135 new_command.extend(('--accept', 'postpone')) |
1134 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1136 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1135 new_command.extend(('--accept', 'postpone')) | 1137 new_command.extend(('--accept', 'postpone')) |
1136 return new_command | 1138 return new_command |
OLD | NEW |