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 errno | 9 import errno |
10 import logging | 10 import logging |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 url != 'git://foo' and | 445 url != 'git://foo' and |
446 subprocess2.capture( | 446 subprocess2.capture( |
447 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], | 447 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], |
448 cwd=self.checkout_path).strip() != 'False'): | 448 cwd=self.checkout_path).strip() != 'False'): |
449 self.Print('_____ switching %s to a new upstream' % self.relpath) | 449 self.Print('_____ switching %s to a new upstream' % self.relpath) |
450 if not (options.force or options.reset): | 450 if not (options.force or options.reset): |
451 # Make sure it's clean | 451 # Make sure it's clean |
452 self._CheckClean(rev_str) | 452 self._CheckClean(rev_str) |
453 # Switch over to the new upstream | 453 # Switch over to the new upstream |
454 self._Run(['remote', 'set-url', self.remote, url], options) | 454 self._Run(['remote', 'set-url', self.remote, url], options) |
| 455 if mirror: |
| 456 with open(os.path.join( |
| 457 self.checkout_path, '.git', 'objects', 'info', 'alternates'), |
| 458 'w') as fh: |
| 459 fh.write(os.path.join(url, 'objects')) |
455 self._FetchAndReset(revision, file_list, options) | 460 self._FetchAndReset(revision, file_list, options) |
456 return_early = True | 461 return_early = True |
457 | 462 |
458 if return_early: | 463 if return_early: |
459 return self._Capture(['rev-parse', '--verify', 'HEAD']) | 464 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
460 | 465 |
461 cur_branch = self._GetCurrentBranch() | 466 cur_branch = self._GetCurrentBranch() |
462 | 467 |
463 # Cases: | 468 # Cases: |
464 # 0) HEAD is detached. Probably from our initial clone. | 469 # 0) HEAD is detached. Probably from our initial clone. |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 new_command.append('--force') | 1642 new_command.append('--force') |
1638 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1643 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1639 new_command.extend(('--accept', 'theirs-conflict')) | 1644 new_command.extend(('--accept', 'theirs-conflict')) |
1640 elif options.manually_grab_svn_rev: | 1645 elif options.manually_grab_svn_rev: |
1641 new_command.append('--force') | 1646 new_command.append('--force') |
1642 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1647 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1643 new_command.extend(('--accept', 'postpone')) | 1648 new_command.extend(('--accept', 'postpone')) |
1644 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1649 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1645 new_command.extend(('--accept', 'postpone')) | 1650 new_command.extend(('--accept', 'postpone')) |
1646 return new_command | 1651 return new_command |
OLD | NEW |