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

Side by Side Diff: gclient_scm.py

Issue 246433005: gclient: Only _DeleteOrMove if the destination directory is non-empty (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 8 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 | tests/gclient_scm_test.py » ('j') | 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 logging 9 import logging
10 import os 10 import os
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 revision = revision.replace(self.remote + '/', 'refs/heads/') 345 revision = revision.replace(self.remote + '/', 'refs/heads/')
346 rev_type = "branch" 346 rev_type = "branch"
347 else: 347 else:
348 # hash is also a tag, only make a distinction at checkout 348 # hash is also a tag, only make a distinction at checkout
349 rev_type = "hash" 349 rev_type = "hash"
350 350
351 if (not os.path.exists(self.checkout_path) or 351 if (not os.path.exists(self.checkout_path) or
352 (os.path.isdir(self.checkout_path) and 352 (os.path.isdir(self.checkout_path) and
353 not os.path.exists(os.path.join(self.checkout_path, '.git')))): 353 not os.path.exists(os.path.join(self.checkout_path, '.git')))):
354 if (os.path.isdir(self.checkout_path) and 354 if (os.path.isdir(self.checkout_path) and
355 not os.path.exists(os.path.join(self.checkout_path, '.git'))): 355 not os.path.exists(os.path.join(self.checkout_path, '.git')) and
356 os.listdir(self.checkout_path)):
356 # This is a little hack to work around checkouts which are created 357 # This is a little hack to work around checkouts which are created
357 # using "gclient config --name ." 358 # using "gclient config --name ."
358 if not self.relpath == '.': 359 if not self.relpath == '.':
359 self._DeleteOrMove(options.force) 360 self._DeleteOrMove(options.force)
360 self._Clone(revision, url, options) 361 self._Clone(revision, url, options)
361 self._UpdateBranchHeads(options, fetch=True) 362 self._UpdateBranchHeads(options, fetch=True)
362 if file_list is not None: 363 if file_list is not None:
363 files = self._Capture(['ls-files']).splitlines() 364 files = self._Capture(['ls-files']).splitlines()
364 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 365 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
365 if not verbose: 366 if not verbose:
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 new_command.append('--force') 1462 new_command.append('--force')
1462 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1463 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1463 new_command.extend(('--accept', 'theirs-conflict')) 1464 new_command.extend(('--accept', 'theirs-conflict'))
1464 elif options.manually_grab_svn_rev: 1465 elif options.manually_grab_svn_rev:
1465 new_command.append('--force') 1466 new_command.append('--force')
1466 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1467 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1467 new_command.extend(('--accept', 'postpone')) 1468 new_command.extend(('--accept', 'postpone'))
1468 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1469 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1469 new_command.extend(('--accept', 'postpone')) 1470 new_command.extend(('--accept', 'postpone'))
1470 return new_command 1471 return new_command
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698