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

Side by Side Diff: gclient_scm.py

Issue 2856038: gclient: fetch only what's needed (Closed)
Patch Set: Fixed Created 10 years, 5 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 | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 logging.debug("Current branch is not tracking an upstream (remote)" 250 logging.debug("Current branch is not tracking an upstream (remote)"
251 " branch.") 251 " branch.")
252 elif upstream_branch.startswith('refs/remotes'): 252 elif upstream_branch.startswith('refs/remotes'):
253 current_type = "branch" 253 current_type = "branch"
254 else: 254 else:
255 raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch) 255 raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch)
256 256
257 # Update the remotes first so we have all the refs. 257 # Update the remotes first so we have all the refs.
258 for _ in range(10): 258 for _ in range(10):
259 try: 259 try:
260 remote_output, remote_err = scm.GIT.Capture( 260 if current_type == "branch":
261 remote_output, remote_err = scm.GIT.Capture(
262 ['fetch'] + verbose + ['origin', revision],
263 self.checkout_path,
264 print_error=False)
265 else:
266 remote_output, remote_err = scm.GIT.Capture(
261 ['remote'] + verbose + ['update'], 267 ['remote'] + verbose + ['update'],
262 self.checkout_path, 268 self.checkout_path,
263 print_error=False) 269 print_error=False)
264 break 270 break
265 except gclient_utils.CheckCallError, e: 271 except gclient_utils.CheckCallError, e:
266 # Hackish but at that point, git is known to work so just checking for 272 # Hackish but at that point, git is known to work so just checking for
267 # 502 in stderr should be fine. 273 # 502 in stderr should be fine.
268 if '502' in e.stderr: 274 if '502' in e.stderr:
269 print str(e) 275 print str(e)
270 print "Sleeping 15 seconds and retrying..." 276 print "Sleeping 15 seconds and retrying..."
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 command should be a list of strings that represents an svn command. 934 command should be a list of strings that represents an svn command.
929 935
930 This method returns a new list to be used as a command.""" 936 This method returns a new list to be used as a command."""
931 new_command = command[:] 937 new_command = command[:]
932 if revision: 938 if revision:
933 new_command.extend(['--revision', str(revision).strip()]) 939 new_command.extend(['--revision', str(revision).strip()])
934 # --force was added to 'svn update' in svn 1.5. 940 # --force was added to 'svn update' in svn 1.5.
935 if options.force and scm.SVN.AssertVersion("1.5")[0]: 941 if options.force and scm.SVN.AssertVersion("1.5")[0]:
936 new_command.append('--force') 942 new_command.append('--force')
937 return new_command 943 return new_command
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698