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

Side by Side Diff: gclient_scm.py

Issue 344443002: Revert "If managed=False, don't fetch." (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 | 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 errno 9 import errno
10 import logging 10 import logging
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 rev_str = ' at %s' % revision 349 rev_str = ' at %s' % revision
350 files = [] if file_list is not None else None 350 files = [] if file_list is not None else None
351 351
352 printed_path = False 352 printed_path = False
353 verbose = [] 353 verbose = []
354 if options.verbose: 354 if options.verbose:
355 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) 355 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
356 verbose = ['--verbose'] 356 verbose = ['--verbose']
357 printed_path = True 357 printed_path = True
358 358
359 if not managed:
360 self.Print('________ unmanaged solution; skipping %s' % self.relpath)
361 try:
362 return self._Capture(['rev-parse', '--verify', 'HEAD'])
363 except subprocess2.CalledProcessError:
364 return None
365
366 url = self._CreateOrUpdateCache(url, options) 359 url = self._CreateOrUpdateCache(url, options)
367 360
368 if revision.startswith('refs/'): 361 if revision.startswith('refs/'):
369 rev_type = "branch" 362 rev_type = "branch"
370 elif revision.startswith(self.remote + '/'): 363 elif revision.startswith(self.remote + '/'):
371 # Rewrite remote refs to their local equivalents. 364 # Rewrite remote refs to their local equivalents.
372 revision = 'refs/remotes/' + revision 365 revision = 'refs/remotes/' + revision
373 rev_type = "branch" 366 rev_type = "branch"
374 else: 367 else:
375 # hash is also a tag, only make a distinction at checkout 368 # hash is also a tag, only make a distinction at checkout
(...skipping 13 matching lines...) Expand all
389 self._Capture(['checkout', '--quiet', deps_branch]) 382 self._Capture(['checkout', '--quiet', deps_branch])
390 if file_list is not None: 383 if file_list is not None:
391 files = self._Capture(['ls-files']).splitlines() 384 files = self._Capture(['ls-files']).splitlines()
392 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 385 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
393 if not verbose: 386 if not verbose:
394 # Make the output a little prettier. It's nice to have some whitespace 387 # Make the output a little prettier. It's nice to have some whitespace
395 # between projects when cloning. 388 # between projects when cloning.
396 self.Print('') 389 self.Print('')
397 return self._Capture(['rev-parse', '--verify', 'HEAD']) 390 return self._Capture(['rev-parse', '--verify', 'HEAD'])
398 391
392 if not managed:
393 self._UpdateBranchHeads(options, fetch=False)
394 self.Print('________ unmanaged solution; skipping %s' % self.relpath)
395 return self._Capture(['rev-parse', '--verify', 'HEAD'])
396
399 # See if the url has changed (the unittests use git://foo for the url, let 397 # See if the url has changed (the unittests use git://foo for the url, let
400 # that through). 398 # that through).
401 current_url = self._Capture(['config', 'remote.%s.url' % self.remote]) 399 current_url = self._Capture(['config', 'remote.%s.url' % self.remote])
402 return_early = False 400 return_early = False
403 # TODO(maruel): Delete url != 'git://foo' since it's just to make the 401 # TODO(maruel): Delete url != 'git://foo' since it's just to make the
404 # unit test pass. (and update the comment above) 402 # unit test pass. (and update the comment above)
405 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set. 403 # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set.
406 # This allows devs to use experimental repos which have a different url 404 # This allows devs to use experimental repos which have a different url
407 # but whose branch(s) are the same as official repos. 405 # but whose branch(s) are the same as official repos.
408 if (current_url.rstrip('/') != url.rstrip('/') and 406 if (current_url.rstrip('/') != url.rstrip('/') and
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 new_command.append('--force') 1483 new_command.append('--force')
1486 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1484 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1487 new_command.extend(('--accept', 'theirs-conflict')) 1485 new_command.extend(('--accept', 'theirs-conflict'))
1488 elif options.manually_grab_svn_rev: 1486 elif options.manually_grab_svn_rev:
1489 new_command.append('--force') 1487 new_command.append('--force')
1490 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1488 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1491 new_command.extend(('--accept', 'postpone')) 1489 new_command.extend(('--accept', 'postpone'))
1492 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1490 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1493 new_command.extend(('--accept', 'postpone')) 1491 new_command.extend(('--accept', 'postpone'))
1494 return new_command 1492 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