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

Side by Side Diff: gclient_scm.py

Issue 2405173003: Revert of Remove SVN and File support from gclient (Closed)
Patch Set: Created 4 years, 2 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 | « gclient.py ('k') | tests/gclient_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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 # Check again for a revision in case an initial ref was specified 385 # Check again for a revision in case an initial ref was specified
386 # in the url, for example bla.git@refs/heads/custombranch 386 # in the url, for example bla.git@refs/heads/custombranch
387 revision = deps_revision 387 revision = deps_revision
388 managed = False 388 managed = False
389 if not revision: 389 if not revision:
390 revision = default_rev 390 revision = default_rev
391 391
392 if managed: 392 if managed:
393 self._DisableHooks() 393 self._DisableHooks()
394 394
395 if gclient_utils.IsDateRevision(revision):
396 # Date-revisions only work on git-repositories if the reflog hasn't
397 # expired yet. Use rev-list to get the corresponding revision.
398 # git rev-list -n 1 --before='time-stamp' branchname
399 if options.transitive:
400 self.Print('Warning: --transitive only works for SVN repositories.')
401 revision = default_rev
402
395 rev_str = ' at %s' % revision 403 rev_str = ' at %s' % revision
396 files = [] if file_list is not None else None 404 files = [] if file_list is not None else None
397 405
398 printed_path = False 406 printed_path = False
399 verbose = [] 407 verbose = []
400 if options.verbose: 408 if options.verbose:
401 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) 409 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False)
402 verbose = ['--verbose'] 410 verbose = ['--verbose']
403 printed_path = True 411 printed_path = True
404 412
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 os.path.join(self.checkout_path, d[1])) 1485 os.path.join(self.checkout_path, d[1]))
1478 self.Print('Removing troublesome path %s' % path_to_remove) 1486 self.Print('Removing troublesome path %s' % path_to_remove)
1479 gclient_utils.rmtree(path_to_remove) 1487 gclient_utils.rmtree(path_to_remove)
1480 else: 1488 else:
1481 self.Print( 1489 self.Print(
1482 'Not removing troublesome path %s automatically.' % d[1]) 1490 'Not removing troublesome path %s automatically.' % d[1])
1483 if d[0][0] == '!': 1491 if d[0][0] == '!':
1484 self.Print('You can pass --force to enable automatic removal.') 1492 self.Print('You can pass --force to enable automatic removal.')
1485 raise e 1493 raise e
1486 1494
1495 # Retrieve the current HEAD version because svn is slow at null updates.
1496 if options.manually_grab_svn_rev and not revision:
1497 from_info_live = scm.SVN.CaptureRemoteInfo(from_info['URL'])
1498 revision = str(from_info_live['Revision'])
1499 rev_str = ' at %s' % revision
1500
1487 if from_info['URL'].rstrip('/') != base_url.rstrip('/'): 1501 if from_info['URL'].rstrip('/') != base_url.rstrip('/'):
1488 # The repository url changed, need to switch. 1502 # The repository url changed, need to switch.
1489 try: 1503 try:
1490 to_info = scm.SVN.CaptureRemoteInfo(url) 1504 to_info = scm.SVN.CaptureRemoteInfo(url)
1491 except (gclient_utils.Error, subprocess2.CalledProcessError): 1505 except (gclient_utils.Error, subprocess2.CalledProcessError):
1492 # The url is invalid or the server is not accessible, it's safer to bail 1506 # The url is invalid or the server is not accessible, it's safer to bail
1493 # out right now. 1507 # out right now.
1494 raise gclient_utils.Error('This url is unreachable: %s' % url) 1508 raise gclient_utils.Error('This url is unreachable: %s' % url)
1495 can_switch = ((from_info['Repository Root'] != to_info['Repository Root']) 1509 can_switch = ((from_info['Repository Root'] != to_info['Repository Root'])
1496 and (from_info['UUID'] == to_info['UUID'])) 1510 and (from_info['UUID'] == to_info['UUID']))
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 # --accept was added to 'svn update' in svn 1.6. 1720 # --accept was added to 'svn update' in svn 1.6.
1707 if not scm.SVN.AssertVersion('1.5')[0]: 1721 if not scm.SVN.AssertVersion('1.5')[0]:
1708 return new_command 1722 return new_command
1709 1723
1710 # It's annoying to have it block in the middle of a sync, just sensible 1724 # It's annoying to have it block in the middle of a sync, just sensible
1711 # defaults. 1725 # defaults.
1712 if options.force: 1726 if options.force:
1713 new_command.append('--force') 1727 new_command.append('--force')
1714 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1728 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1715 new_command.extend(('--accept', 'theirs-conflict')) 1729 new_command.extend(('--accept', 'theirs-conflict'))
1730 elif options.manually_grab_svn_rev:
1731 new_command.append('--force')
1732 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1733 new_command.extend(('--accept', 'postpone'))
1716 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1734 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1717 new_command.extend(('--accept', 'postpone')) 1735 new_command.extend(('--accept', 'postpone'))
1718 return new_command 1736 return new_command
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698