Chromium Code Reviews| 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 import collections | 7 import collections |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 default_rev = "refs/heads/master" | 609 default_rev = "refs/heads/master" |
| 610 if options.upstream: | 610 if options.upstream: |
| 611 if self._GetCurrentBranch(): | 611 if self._GetCurrentBranch(): |
| 612 upstream_branch = scm.GIT.GetUpstreamBranch(self.checkout_path) | 612 upstream_branch = scm.GIT.GetUpstreamBranch(self.checkout_path) |
| 613 default_rev = upstream_branch or default_rev | 613 default_rev = upstream_branch or default_rev |
| 614 _, deps_revision = gclient_utils.SplitUrlRevision(self.url) | 614 _, deps_revision = gclient_utils.SplitUrlRevision(self.url) |
| 615 if not deps_revision: | 615 if not deps_revision: |
| 616 deps_revision = default_rev | 616 deps_revision = default_rev |
| 617 if deps_revision.startswith('refs/heads/'): | 617 if deps_revision.startswith('refs/heads/'): |
| 618 deps_revision = deps_revision.replace('refs/heads/', self.remote + '/') | 618 deps_revision = deps_revision.replace('refs/heads/', self.remote + '/') |
| 619 deps_revision = self.GetUsableRev(deps_revision, options) | |
| 619 | 620 |
| 620 if file_list is not None: | 621 if file_list is not None: |
| 621 files = self._Capture(['diff', deps_revision, '--name-only']).split() | 622 files = self._Capture(['diff', deps_revision, '--name-only']).split() |
| 622 | 623 |
| 623 self._Run(['reset', '--hard', deps_revision], options) | 624 self._Run(['reset', '--hard', deps_revision], options) |
| 624 self._Run(['clean', '-f', '-d'], options) | 625 self._Run(['clean', '-f', '-d'], options) |
| 625 | 626 |
| 626 if file_list is not None: | 627 if file_list is not None: |
| 627 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) | 628 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) |
| 628 | 629 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 ( 'It appears that either your git-svn remote is incorrectly\n' | 691 ( 'It appears that either your git-svn remote is incorrectly\n' |
| 691 'configured or the revision in your safesync_url is\n' | 692 'configured or the revision in your safesync_url is\n' |
| 692 'higher than git-svn remote\'s HEAD as we couldn\'t find a\n' | 693 'higher than git-svn remote\'s HEAD as we couldn\'t find a\n' |
| 693 'corresponding git hash for SVN rev %s.' ) % rev) | 694 'corresponding git hash for SVN rev %s.' ) % rev) |
| 694 else: | 695 else: |
| 695 if scm.GIT.IsValidRevision(cwd=self.checkout_path, rev=rev): | 696 if scm.GIT.IsValidRevision(cwd=self.checkout_path, rev=rev): |
| 696 sha1 = rev | 697 sha1 = rev |
| 697 else: | 698 else: |
| 698 # May exist in origin, but we don't have it yet, so fetch and look | 699 # May exist in origin, but we don't have it yet, so fetch and look |
| 699 # again. | 700 # again. |
| 700 scm.GIT.Capture(['fetch', self.remote], cwd=self.checkout_path) | 701 scm.GIT.Capture(['fetch', self.remote], cwd=self.checkout_path) |
|
iannucci
2014/02/20 00:06:25
Note this doesn't work with cache_dir. I'll do tha
| |
| 701 if scm.GIT.IsValidRevision(cwd=self.checkout_path, rev=rev): | 702 if scm.GIT.IsValidRevision(cwd=self.checkout_path, rev=rev): |
| 702 sha1 = rev | 703 sha1 = rev |
| 703 | 704 |
| 704 if not sha1: | 705 if not sha1: |
| 705 raise gclient_utils.Error( | 706 raise gclient_utils.Error( |
| 706 ( 'We could not find a valid hash for safesync_url response "%s".\n' | 707 ( 'We could not find a valid hash for safesync_url response "%s".\n' |
| 707 'Safesync URLs with a git checkout currently require a git-svn\n' | 708 'Safesync URLs with a git checkout currently require a git-svn\n' |
| 708 'remote or a safesync_url that provides git sha1s. Please add a\n' | 709 'remote or a safesync_url that provides git sha1s. Please add a\n' |
| 709 'git-svn remote or change your safesync_url. For more info, see:\n' | 710 'git-svn remote or change your safesync_url. For more info, see:\n' |
| 710 'http://code.google.com/p/chromium/wiki/UsingNewGit' | 711 'http://code.google.com/p/chromium/wiki/UsingNewGit' |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1543 new_command.append('--force') | 1544 new_command.append('--force') |
| 1544 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1545 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1545 new_command.extend(('--accept', 'theirs-conflict')) | 1546 new_command.extend(('--accept', 'theirs-conflict')) |
| 1546 elif options.manually_grab_svn_rev: | 1547 elif options.manually_grab_svn_rev: |
| 1547 new_command.append('--force') | 1548 new_command.append('--force') |
| 1548 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1549 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1549 new_command.extend(('--accept', 'postpone')) | 1550 new_command.extend(('--accept', 'postpone')) |
| 1550 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1551 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1551 new_command.extend(('--accept', 'postpone')) | 1552 new_command.extend(('--accept', 'postpone')) |
| 1552 return new_command | 1553 return new_command |
| OLD | NEW |