OLD | NEW |
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 Loading... |
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 if rev_type == "branch": | 260 remote_output, remote_err = scm.GIT.Capture( |
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( | |
267 ['remote'] + verbose + ['update'], | 261 ['remote'] + verbose + ['update'], |
268 self.checkout_path, | 262 self.checkout_path, |
269 print_error=False) | 263 print_error=False) |
270 break | 264 break |
271 except gclient_utils.CheckCallError, e: | 265 except gclient_utils.CheckCallError, e: |
272 # Hackish but at that point, git is known to work so just checking for | 266 # Hackish but at that point, git is known to work so just checking for |
273 # 502 in stderr should be fine. | 267 # 502 in stderr should be fine. |
274 if '502' in e.stderr: | 268 if '502' in e.stderr: |
275 print str(e) | 269 print str(e) |
276 print "Sleeping 15 seconds and retrying..." | 270 print "Sleeping 15 seconds and retrying..." |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 command should be a list of strings that represents an svn command. | 928 command should be a list of strings that represents an svn command. |
935 | 929 |
936 This method returns a new list to be used as a command.""" | 930 This method returns a new list to be used as a command.""" |
937 new_command = command[:] | 931 new_command = command[:] |
938 if revision: | 932 if revision: |
939 new_command.extend(['--revision', str(revision).strip()]) | 933 new_command.extend(['--revision', str(revision).strip()]) |
940 # --force was added to 'svn update' in svn 1.5. | 934 # --force was added to 'svn update' in svn 1.5. |
941 if options.force and scm.SVN.AssertVersion("1.5")[0]: | 935 if options.force and scm.SVN.AssertVersion("1.5")[0]: |
942 new_command.append('--force') | 936 new_command.append('--force') |
943 return new_command | 937 return new_command |
OLD | NEW |