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

Side by Side Diff: gclient_scm.py

Issue 9379005: [depot_tools] Use git fetch to optimize the properly configured that use git-svn (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: removing less related changes because maruel@ likes reviews Created 8 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 # [0-9]{1,6} for now to avoid making a network request. 493 # [0-9]{1,6} for now to avoid making a network request.
494 if rev.isdigit() and len(rev) < 7: 494 if rev.isdigit() and len(rev) < 7:
495 # If the content of the safesync_url appears to be an SVN rev and the 495 # If the content of the safesync_url appears to be an SVN rev and the
496 # URL of the source appears to be git, we can only attempt to find out 496 # URL of the source appears to be git, we can only attempt to find out
497 # if a revision is useful after we've cloned the original URL, so just 497 # if a revision is useful after we've cloned the original URL, so just
498 # ignore for now. 498 # ignore for now.
499 if (os.path.isdir(self.checkout_path) and 499 if (os.path.isdir(self.checkout_path) and
500 scm.GIT.IsGitSvn(cwd=self.checkout_path)): 500 scm.GIT.IsGitSvn(cwd=self.checkout_path)):
501 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path) 501 local_head = scm.GIT.GetGitSvnHeadRev(cwd=self.checkout_path)
502 if not local_head or local_head < int(rev): 502 if not local_head or local_head < int(rev):
503 try:
504 logging.debug('Looking for git-svn configuration optimizations.')
505 if scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'],
506 cwd=self.checkout_path):
507 scm.GIT.Capture(['fetch'], cwd=self.checkout_path)
508 except subprocess2.CalledProcessError:
509 logging.debug('git config --get svn-remote.svn.fetch failed, '
510 'ignoring possible optimization.')
503 if options.verbose: 511 if options.verbose:
504 print('Running git svn fetch. This might take a while.\n') 512 print('Running git svn fetch. This might take a while.\n')
505 scm.GIT.Capture(['svn', 'fetch'], cwd=self.checkout_path) 513 scm.GIT.Capture(['svn', 'fetch'], cwd=self.checkout_path)
506 sha1 = scm.GIT.GetSha1ForSvnRev(cwd=self.checkout_path, rev=rev) 514 sha1 = scm.GIT.GetSha1ForSvnRev(cwd=self.checkout_path, rev=rev)
507 if not sha1: 515 if not sha1:
508 raise gclient_utils.Error( 516 raise gclient_utils.Error(
509 ( 'It appears that either your git-svn remote is incorrectly\n' 517 ( 'It appears that either your git-svn remote is incorrectly\n'
510 'configured or the revision in your safesync_url is\n' 518 'configured or the revision in your safesync_url is\n'
511 'higher than git-svn remote\'s HEAD as we couldn\'t find a\n' 519 'higher than git-svn remote\'s HEAD as we couldn\'t find a\n'
512 'corresponding git hash for SVN rev %s.' ) % rev) 520 'corresponding git hash for SVN rev %s.' ) % rev)
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 new_command.append('--force') 1101 new_command.append('--force')
1094 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1102 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1095 new_command.extend(('--accept', 'theirs-conflict')) 1103 new_command.extend(('--accept', 'theirs-conflict'))
1096 elif options.manually_grab_svn_rev: 1104 elif options.manually_grab_svn_rev:
1097 new_command.append('--force') 1105 new_command.append('--force')
1098 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1106 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1099 new_command.extend(('--accept', 'postpone')) 1107 new_command.extend(('--accept', 'postpone'))
1100 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1108 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1101 new_command.extend(('--accept', 'postpone')) 1109 new_command.extend(('--accept', 'postpone'))
1102 return new_command 1110 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