| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |