OLD | NEW |
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 Loading... |
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 | |
403 rev_str = ' at %s' % revision | 395 rev_str = ' at %s' % revision |
404 files = [] if file_list is not None else None | 396 files = [] if file_list is not None else None |
405 | 397 |
406 printed_path = False | 398 printed_path = False |
407 verbose = [] | 399 verbose = [] |
408 if options.verbose: | 400 if options.verbose: |
409 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) | 401 self.Print('_____ %s%s' % (self.relpath, rev_str), timestamp=False) |
410 verbose = ['--verbose'] | 402 verbose = ['--verbose'] |
411 printed_path = True | 403 printed_path = True |
412 | 404 |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 os.path.join(self.checkout_path, d[1])) | 1477 os.path.join(self.checkout_path, d[1])) |
1486 self.Print('Removing troublesome path %s' % path_to_remove) | 1478 self.Print('Removing troublesome path %s' % path_to_remove) |
1487 gclient_utils.rmtree(path_to_remove) | 1479 gclient_utils.rmtree(path_to_remove) |
1488 else: | 1480 else: |
1489 self.Print( | 1481 self.Print( |
1490 'Not removing troublesome path %s automatically.' % d[1]) | 1482 'Not removing troublesome path %s automatically.' % d[1]) |
1491 if d[0][0] == '!': | 1483 if d[0][0] == '!': |
1492 self.Print('You can pass --force to enable automatic removal.') | 1484 self.Print('You can pass --force to enable automatic removal.') |
1493 raise e | 1485 raise e |
1494 | 1486 |
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 | |
1501 if from_info['URL'].rstrip('/') != base_url.rstrip('/'): | 1487 if from_info['URL'].rstrip('/') != base_url.rstrip('/'): |
1502 # The repository url changed, need to switch. | 1488 # The repository url changed, need to switch. |
1503 try: | 1489 try: |
1504 to_info = scm.SVN.CaptureRemoteInfo(url) | 1490 to_info = scm.SVN.CaptureRemoteInfo(url) |
1505 except (gclient_utils.Error, subprocess2.CalledProcessError): | 1491 except (gclient_utils.Error, subprocess2.CalledProcessError): |
1506 # The url is invalid or the server is not accessible, it's safer to bail | 1492 # The url is invalid or the server is not accessible, it's safer to bail |
1507 # out right now. | 1493 # out right now. |
1508 raise gclient_utils.Error('This url is unreachable: %s' % url) | 1494 raise gclient_utils.Error('This url is unreachable: %s' % url) |
1509 can_switch = ((from_info['Repository Root'] != to_info['Repository Root']) | 1495 can_switch = ((from_info['Repository Root'] != to_info['Repository Root']) |
1510 and (from_info['UUID'] == to_info['UUID'])) | 1496 and (from_info['UUID'] == to_info['UUID'])) |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 # --accept was added to 'svn update' in svn 1.6. | 1706 # --accept was added to 'svn update' in svn 1.6. |
1721 if not scm.SVN.AssertVersion('1.5')[0]: | 1707 if not scm.SVN.AssertVersion('1.5')[0]: |
1722 return new_command | 1708 return new_command |
1723 | 1709 |
1724 # It's annoying to have it block in the middle of a sync, just sensible | 1710 # It's annoying to have it block in the middle of a sync, just sensible |
1725 # defaults. | 1711 # defaults. |
1726 if options.force: | 1712 if options.force: |
1727 new_command.append('--force') | 1713 new_command.append('--force') |
1728 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1714 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1729 new_command.extend(('--accept', 'theirs-conflict')) | 1715 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')) | |
1734 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1716 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1735 new_command.extend(('--accept', 'postpone')) | 1717 new_command.extend(('--accept', 'postpone')) |
1736 return new_command | 1718 return new_command |
OLD | NEW |