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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 # This is a big hammer, debatable if it should even be here... | 547 # This is a big hammer, debatable if it should even be here... |
548 if options.force or options.reset: | 548 if options.force or options.reset: |
549 target = 'HEAD' | 549 target = 'HEAD' |
550 if options.upstream and upstream_branch: | 550 if options.upstream and upstream_branch: |
551 target = upstream_branch | 551 target = upstream_branch |
552 self._Run(['reset', '--hard', target], options) | 552 self._Run(['reset', '--hard', target], options) |
553 | 553 |
554 if current_type == 'detached': | 554 if current_type == 'detached': |
555 # case 0 | 555 # case 0 |
556 if not options.force: | 556 self._CheckClean(rev_str) |
557 # Don't do this check if nuclear option is on. | |
558 self._CheckClean(rev_str) | |
559 self._CheckDetachedHead(rev_str, options) | 557 self._CheckDetachedHead(rev_str, options) |
560 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: | 558 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: |
561 self.Print('Up-to-date; skipping checkout.') | 559 self.Print('Up-to-date; skipping checkout.') |
562 else: | 560 else: |
563 # 'git checkout' may need to overwrite existing untracked files. Allow | 561 # 'git checkout' may need to overwrite existing untracked files. Allow |
564 # it only when nuclear options are enabled. | 562 # it only when nuclear options are enabled. |
565 self._Checkout( | 563 self._Checkout( |
566 options, | 564 options, |
567 revision, | 565 revision, |
568 force=(options.force or options.delete_unversioned_trees), | 566 force=(options.force and options.delete_unversioned_trees), |
569 quiet=True, | 567 quiet=True, |
570 ) | 568 ) |
571 if not printed_path: | 569 if not printed_path: |
572 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 570 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) |
573 elif current_type == 'hash': | 571 elif current_type == 'hash': |
574 # case 1 | 572 # case 1 |
575 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: | 573 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: |
576 # Our git-svn branch (upstream_branch) is our upstream | 574 # Our git-svn branch (upstream_branch) is our upstream |
577 self._AttemptRebase(upstream_branch, files, options, | 575 self._AttemptRebase(upstream_branch, files, options, |
578 newbase=revision, printed_path=printed_path, | 576 newbase=revision, printed_path=printed_path, |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 new_command.append('--force') | 1713 new_command.append('--force') |
1716 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1714 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1717 new_command.extend(('--accept', 'theirs-conflict')) | 1715 new_command.extend(('--accept', 'theirs-conflict')) |
1718 elif options.manually_grab_svn_rev: | 1716 elif options.manually_grab_svn_rev: |
1719 new_command.append('--force') | 1717 new_command.append('--force') |
1720 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1718 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1721 new_command.extend(('--accept', 'postpone')) | 1719 new_command.extend(('--accept', 'postpone')) |
1722 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1720 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1723 new_command.extend(('--accept', 'postpone')) | 1721 new_command.extend(('--accept', 'postpone')) |
1724 return new_command | 1722 return new_command |
OLD | NEW |