Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: gclient_scm.py

Issue 1916973002: Gclient: Don't check if repository is clean if --force is passed in (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Plan B Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 self._CheckClean(rev_str) 556 if not options.force:
557 # Don't do this check if nuclear option is on.
558 self._CheckClean(rev_str)
557 self._CheckDetachedHead(rev_str, options) 559 self._CheckDetachedHead(rev_str, options)
558 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: 560 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision:
559 self.Print('Up-to-date; skipping checkout.') 561 self.Print('Up-to-date; skipping checkout.')
560 else: 562 else:
561 # 'git checkout' may need to overwrite existing untracked files. Allow 563 # 'git checkout' may need to overwrite existing untracked files. Allow
562 # it only when nuclear options are enabled. 564 # it only when nuclear options are enabled.
563 self._Checkout( 565 self._Checkout(
564 options, 566 options,
565 revision, 567 revision,
566 force=(options.force and options.delete_unversioned_trees), 568 force=(options.force or options.delete_unversioned_trees),
567 quiet=True, 569 quiet=True,
568 ) 570 )
569 if not printed_path: 571 if not printed_path:
570 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) 572 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
571 elif current_type == 'hash': 573 elif current_type == 'hash':
572 # case 1 574 # case 1
573 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: 575 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None:
574 # Our git-svn branch (upstream_branch) is our upstream 576 # Our git-svn branch (upstream_branch) is our upstream
575 self._AttemptRebase(upstream_branch, files, options, 577 self._AttemptRebase(upstream_branch, files, options,
576 newbase=revision, printed_path=printed_path, 578 newbase=revision, printed_path=printed_path,
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 new_command.append('--force') 1715 new_command.append('--force')
1714 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1716 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1715 new_command.extend(('--accept', 'theirs-conflict')) 1717 new_command.extend(('--accept', 'theirs-conflict'))
1716 elif options.manually_grab_svn_rev: 1718 elif options.manually_grab_svn_rev:
1717 new_command.append('--force') 1719 new_command.append('--force')
1718 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1720 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1719 new_command.extend(('--accept', 'postpone')) 1721 new_command.extend(('--accept', 'postpone'))
1720 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1722 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1721 new_command.extend(('--accept', 'postpone')) 1723 new_command.extend(('--accept', 'postpone'))
1722 return new_command 1724 return new_command
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698