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

Side by Side Diff: gclient_scm.py

Issue 7859032: Now that CheckCallAndFilter() throws subprocess2.CalledProcessError, use e.returncode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 3 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 | 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) 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 # If the parent directory does not exist, Git clone on Windows will not 499 # If the parent directory does not exist, Git clone on Windows will not
500 # create it, so we need to do it manually. 500 # create it, so we need to do it manually.
501 parent_dir = os.path.dirname(self.checkout_path) 501 parent_dir = os.path.dirname(self.checkout_path)
502 if not os.path.exists(parent_dir): 502 if not os.path.exists(parent_dir):
503 os.makedirs(parent_dir) 503 os.makedirs(parent_dir)
504 504
505 for _ in range(3): 505 for _ in range(3):
506 try: 506 try:
507 self._Run(clone_cmd, options, cwd=self._root_dir) 507 self._Run(clone_cmd, options, cwd=self._root_dir)
508 break 508 break
509 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 509 except subprocess2.CalledProcessError, e:
510 # TODO(maruel): Hackish, should be fixed by moving _Run() to 510 # Too bad we don't have access to the actual output yet.
511 # subprocess2.check_output().
512 # Too bad we don't have access to the actual output.
513 # We should check for "transfer closed with NNN bytes remaining to 511 # We should check for "transfer closed with NNN bytes remaining to
514 # read". In the meantime, just make sure .git exists. 512 # read". In the meantime, just make sure .git exists.
515 if (e.args[0] == 'git command clone returned 128' and 513 if (e.returncode == 128 and
516 os.path.exists(os.path.join(self.checkout_path, '.git'))): 514 os.path.exists(os.path.join(self.checkout_path, '.git'))):
517 print(str(e)) 515 print(str(e))
518 print('Retrying...') 516 print('Retrying...')
519 continue 517 continue
520 raise e 518 raise e
521 519
522 if detach_head: 520 if detach_head:
523 # Squelch git's very verbose detached HEAD warning and use our own 521 # Squelch git's very verbose detached HEAD warning and use our own
524 self._Capture(['checkout', '--quiet', '%s' % revision]) 522 self._Capture(['checkout', '--quiet', '%s' % revision])
525 print( 523 print(
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 938
941 This method returns a new list to be used as a command.""" 939 This method returns a new list to be used as a command."""
942 new_command = command[:] 940 new_command = command[:]
943 if revision: 941 if revision:
944 new_command.extend(['--revision', str(revision).strip()]) 942 new_command.extend(['--revision', str(revision).strip()])
945 # --force was added to 'svn update' in svn 1.5. 943 # --force was added to 'svn update' in svn 1.5.
946 if ((options.force or options.manually_grab_svn_rev) and 944 if ((options.force or options.manually_grab_svn_rev) and
947 scm.SVN.AssertVersion("1.5")[0]): 945 scm.SVN.AssertVersion("1.5")[0]):
948 new_command.append('--force') 946 new_command.append('--force')
949 return new_command 947 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