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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 url != 'git://foo' and | 449 url != 'git://foo' and |
450 subprocess2.capture( | 450 subprocess2.capture( |
451 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], | 451 ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote], |
452 cwd=self.checkout_path).strip() != 'False'): | 452 cwd=self.checkout_path).strip() != 'False'): |
453 self.Print('_____ switching %s to a new upstream' % self.relpath) | 453 self.Print('_____ switching %s to a new upstream' % self.relpath) |
454 if not (options.force or options.reset): | 454 if not (options.force or options.reset): |
455 # Make sure it's clean | 455 # Make sure it's clean |
456 self._CheckClean(rev_str) | 456 self._CheckClean(rev_str) |
457 # Switch over to the new upstream | 457 # Switch over to the new upstream |
458 self._Run(['remote', 'set-url', self.remote, url], options) | 458 self._Run(['remote', 'set-url', self.remote, url], options) |
459 self.Print("remote is set", revision, self.url) | |
459 if mirror: | 460 if mirror: |
460 with open(os.path.join( | 461 with open(os.path.join( |
461 self.checkout_path, '.git', 'objects', 'info', 'alternates'), | 462 self.checkout_path, '.git', 'objects', 'info', 'alternates'), |
462 'w') as fh: | 463 'w') as fh: |
463 fh.write(os.path.join(url, 'objects')) | 464 fh.write(os.path.join(url, 'objects')) |
465 try: | |
466 self._Capture(['rev-list', '-n', '1', 'HEAD']) | |
467 except subprocess2.CalledProcessError as e: | |
468 if ('fatal: bad object HEAD' in e.stderr | |
469 and self.cache_dir and self.cache_dir in url): | |
470 self.Print("tAndrii31", "gotcha") | |
Adrian Kuegel
2015/08/21 15:35:58
Do you want to keep this in?
tandrii(chromium)
2015/08/21 15:40:14
nope, but it's helpful to distinguish the cases du
| |
471 self.Print(( | |
472 'Likely due to DEPS change with git cache_dir, ' | |
473 'the current commit points to no longer existing object.\n' | |
474 '%s' % e) | |
475 ) | |
476 self._DeleteOrMove(options.force) | |
477 self._Clone(revision, url, options) | |
478 else: | |
479 raise | |
464 self._FetchAndReset(revision, file_list, options) | 480 self._FetchAndReset(revision, file_list, options) |
481 | |
465 return_early = True | 482 return_early = True |
483 else: | |
484 try: | |
485 self._Capture(['rev-list', '-n', '1', 'HEAD']) | |
486 except subprocess2.CalledProcessError as e: | |
487 if ('fatal: bad object HEAD' in e.stderr | |
488 and self.cache_dir and self.cache_dir in url): | |
489 self.Print("tAndrii41", "gotcha") | |
Adrian Kuegel
2015/08/21 15:35:58
Same question as above.
tandrii(chromium)
2015/08/21 15:40:14
Done.
| |
490 self.Print(( | |
491 'Likely due to DEPS change with git cache_dir, ' | |
492 'the current commit points to no longer existing object.\n' | |
493 '%s' % e) | |
494 ) | |
495 self._DeleteOrMove(options.force) | |
496 self._Clone(revision, url, options) | |
497 else: | |
498 raise | |
466 | 499 |
467 if return_early: | 500 if return_early: |
468 return self._Capture(['rev-parse', '--verify', 'HEAD']) | 501 return self._Capture(['rev-parse', '--verify', 'HEAD']) |
469 | 502 |
470 cur_branch = self._GetCurrentBranch() | 503 cur_branch = self._GetCurrentBranch() |
471 | 504 |
472 # Cases: | 505 # Cases: |
473 # 0) HEAD is detached. Probably from our initial clone. | 506 # 0) HEAD is detached. Probably from our initial clone. |
474 # - make sure HEAD is contained by a named ref, then update. | 507 # - make sure HEAD is contained by a named ref, then update. |
475 # Cases 1-4. HEAD is a branch. | 508 # Cases 1-4. HEAD is a branch. |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1654 new_command.append('--force') | 1687 new_command.append('--force') |
1655 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1688 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1656 new_command.extend(('--accept', 'theirs-conflict')) | 1689 new_command.extend(('--accept', 'theirs-conflict')) |
1657 elif options.manually_grab_svn_rev: | 1690 elif options.manually_grab_svn_rev: |
1658 new_command.append('--force') | 1691 new_command.append('--force') |
1659 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1692 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1660 new_command.extend(('--accept', 'postpone')) | 1693 new_command.extend(('--accept', 'postpone')) |
1661 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1694 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1662 new_command.extend(('--accept', 'postpone')) | 1695 new_command.extend(('--accept', 'postpone')) |
1663 return new_command | 1696 return new_command |
OLD | NEW |