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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 rev_type = "branch" | 346 rev_type = "branch" |
347 else: | 347 else: |
348 # hash is also a tag, only make a distinction at checkout | 348 # hash is also a tag, only make a distinction at checkout |
349 rev_type = "hash" | 349 rev_type = "hash" |
350 | 350 |
351 if (not os.path.exists(self.checkout_path) or | 351 if (not os.path.exists(self.checkout_path) or |
352 (os.path.isdir(self.checkout_path) and | 352 (os.path.isdir(self.checkout_path) and |
353 not os.path.exists(os.path.join(self.checkout_path, '.git')))): | 353 not os.path.exists(os.path.join(self.checkout_path, '.git')))): |
354 if (os.path.isdir(self.checkout_path) and | 354 if (os.path.isdir(self.checkout_path) and |
355 not os.path.exists(os.path.join(self.checkout_path, '.git'))): | 355 not os.path.exists(os.path.join(self.checkout_path, '.git'))): |
356 self._DeleteOrMove(options.force) | 356 # This is a little hack to work around checkouts which are created |
| 357 # using "gclient config --name ." |
| 358 if not self.relpath == '.': |
| 359 self._DeleteOrMove(options.force) |
357 self._Clone(revision, url, options) | 360 self._Clone(revision, url, options) |
358 self._UpdateBranchHeads(options, fetch=True) | 361 self._UpdateBranchHeads(options, fetch=True) |
359 if file_list is not None: | 362 if file_list is not None: |
360 files = self._Capture(['ls-files']).splitlines() | 363 files = self._Capture(['ls-files']).splitlines() |
361 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) | 364 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
362 if not verbose: | 365 if not verbose: |
363 # Make the output a little prettier. It's nice to have some whitespace | 366 # Make the output a little prettier. It's nice to have some whitespace |
364 # between projects when cloning. | 367 # between projects when cloning. |
365 self.Print('') | 368 self.Print('') |
366 return self._Capture(['rev-parse', '--verify', 'HEAD']) | 369 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 new_command.append('--force') | 1456 new_command.append('--force') |
1454 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1457 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1455 new_command.extend(('--accept', 'theirs-conflict')) | 1458 new_command.extend(('--accept', 'theirs-conflict')) |
1456 elif options.manually_grab_svn_rev: | 1459 elif options.manually_grab_svn_rev: |
1457 new_command.append('--force') | 1460 new_command.append('--force') |
1458 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1461 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1459 new_command.extend(('--accept', 'postpone')) | 1462 new_command.extend(('--accept', 'postpone')) |
1460 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1463 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1461 new_command.extend(('--accept', 'postpone')) | 1464 new_command.extend(('--accept', 'postpone')) |
1462 return new_command | 1465 return new_command |
OLD | NEW |