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

Side by Side Diff: gclient_scm.py

Issue 334633004: Allow gclient sync to overwrite untracked files when moving detached git HEAD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 target = upstream_branch 479 target = upstream_branch
480 self._Run(['reset', '--hard', target], options) 480 self._Run(['reset', '--hard', target], options)
481 481
482 if current_type == 'detached': 482 if current_type == 'detached':
483 # case 0 483 # case 0
484 self._CheckClean(rev_str) 484 self._CheckClean(rev_str)
485 self._CheckDetachedHead(rev_str, options) 485 self._CheckDetachedHead(rev_str, options)
486 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision: 486 if self._Capture(['rev-list', '-n', '1', 'HEAD']) == revision:
487 self.Print('Up-to-date; skipping checkout.') 487 self.Print('Up-to-date; skipping checkout.')
488 else: 488 else:
489 self._Capture(['checkout', '--quiet', '%s' % revision]) 489 # 'git checkout' may need to overwrite existing untracked files. Allow
490 # it only when nuclear options are enabled.
491 if options.force and options.delete_unversioned_trees:
Vadim Sh. 2014/06/20 06:46:46 The more natural combination would be "--force --r
492 self._Capture(['checkout', '--force', '--quiet', '%s' % revision])
493 else:
494 self._Capture(['checkout', '--quiet', '%s' % revision])
490 if not printed_path: 495 if not printed_path:
491 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) 496 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
492 elif current_type == 'hash': 497 elif current_type == 'hash':
493 # case 1 498 # case 1
494 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None: 499 if scm.GIT.IsGitSvn(self.checkout_path) and upstream_branch is not None:
495 # Our git-svn branch (upstream_branch) is our upstream 500 # Our git-svn branch (upstream_branch) is our upstream
496 self._AttemptRebase(upstream_branch, files, options, 501 self._AttemptRebase(upstream_branch, files, options,
497 newbase=revision, printed_path=printed_path, 502 newbase=revision, printed_path=printed_path,
498 merge=options.merge) 503 merge=options.merge)
499 printed_path = True 504 printed_path = True
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 new_command.append('--force') 1494 new_command.append('--force')
1490 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1495 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1491 new_command.extend(('--accept', 'theirs-conflict')) 1496 new_command.extend(('--accept', 'theirs-conflict'))
1492 elif options.manually_grab_svn_rev: 1497 elif options.manually_grab_svn_rev:
1493 new_command.append('--force') 1498 new_command.append('--force')
1494 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1499 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1495 new_command.extend(('--accept', 'postpone')) 1500 new_command.extend(('--accept', 'postpone'))
1496 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1501 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1497 new_command.extend(('--accept', 'postpone')) 1502 new_command.extend(('--accept', 'postpone'))
1498 return new_command 1503 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