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

Side by Side Diff: gclient_scm.py

Issue 8359018: Fix a concurrency issue happening with deep dependencies when the intermediary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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 | gclient_utils.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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 rev_type = "branch" 206 rev_type = "branch"
207 elif revision.startswith('origin/'): 207 elif revision.startswith('origin/'):
208 # For compatability with old naming, translate 'origin' to 'refs/heads' 208 # For compatability with old naming, translate 'origin' to 'refs/heads'
209 revision = revision.replace('origin/', 'refs/heads/') 209 revision = revision.replace('origin/', 'refs/heads/')
210 rev_type = "branch" 210 rev_type = "branch"
211 else: 211 else:
212 # hash is also a tag, only make a distinction at checkout 212 # hash is also a tag, only make a distinction at checkout
213 rev_type = "hash" 213 rev_type = "hash"
214 214
215 if not os.path.exists(self.checkout_path): 215 if not os.path.exists(self.checkout_path):
216 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path))
216 self._Clone(revision, url, options) 217 self._Clone(revision, url, options)
217 files = self._Capture(['ls-files']).splitlines() 218 files = self._Capture(['ls-files']).splitlines()
218 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 219 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
219 if not verbose: 220 if not verbose:
220 # Make the output a little prettier. It's nice to have some whitespace 221 # Make the output a little prettier. It's nice to have some whitespace
221 # between projects when cloning. 222 # between projects when cloning.
222 print('') 223 print('')
223 return 224 return
224 225
225 if not managed: 226 if not managed:
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 else: 502 else:
502 detach_head = True 503 detach_head = True
503 if options.verbose: 504 if options.verbose:
504 clone_cmd.append('--verbose') 505 clone_cmd.append('--verbose')
505 clone_cmd.extend([url, self.checkout_path]) 506 clone_cmd.extend([url, self.checkout_path])
506 507
507 # If the parent directory does not exist, Git clone on Windows will not 508 # If the parent directory does not exist, Git clone on Windows will not
508 # create it, so we need to do it manually. 509 # create it, so we need to do it manually.
509 parent_dir = os.path.dirname(self.checkout_path) 510 parent_dir = os.path.dirname(self.checkout_path)
510 if not os.path.exists(parent_dir): 511 if not os.path.exists(parent_dir):
511 os.makedirs(parent_dir) 512 gclient_utils.safe_makedirs(parent_dir)
512 513
513 percent_re = re.compile('.* ([0-9]{1,2})% .*') 514 percent_re = re.compile('.* ([0-9]{1,2})% .*')
514 def _GitFilter(line): 515 def _GitFilter(line):
515 # git uses an escape sequence to clear the line; elide it. 516 # git uses an escape sequence to clear the line; elide it.
516 esc = line.find(unichr(033)) 517 esc = line.find(unichr(033))
517 if esc > -1: 518 if esc > -1:
518 line = line[:esc] 519 line = line[:esc]
519 match = percent_re.match(line) 520 match = percent_re.match(line)
520 if not match or not int(match.group(1)) % 10: 521 if not match or not int(match.group(1)) % 10:
521 print '%s' % line 522 print '%s' % line
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 url = '%s@%s' % (url, revision) 769 url = '%s@%s' % (url, revision)
769 rev_str = ' at %s' % revision 770 rev_str = ' at %s' % revision
770 else: 771 else:
771 managed = False 772 managed = False
772 revision = None 773 revision = None
773 else: 774 else:
774 forced_revision = False 775 forced_revision = False
775 rev_str = '' 776 rev_str = ''
776 777
777 if not os.path.exists(self.checkout_path): 778 if not os.path.exists(self.checkout_path):
779 gclient_utils.safe_makedirs(os.path.dirname(self.checkout_path))
778 # We need to checkout. 780 # We need to checkout.
779 command = ['checkout', url, self.checkout_path] 781 command = ['checkout', url, self.checkout_path]
780 command = self._AddAdditionalUpdateFlags(command, options, revision) 782 command = self._AddAdditionalUpdateFlags(command, options, revision)
781 self._RunAndGetFileList(command, options, file_list, self._root_dir) 783 self._RunAndGetFileList(command, options, file_list, self._root_dir)
782 return 784 return
783 785
784 if not managed: 786 if not managed:
785 print ('________ unmanaged solution; skipping %s' % self.relpath) 787 print ('________ unmanaged solution; skipping %s' % self.relpath)
786 return 788 return
787 789
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 self._RunAndGetFileList(command, options, file_list) 901 self._RunAndGetFileList(command, options, file_list)
900 # After the initial checkout, we can use update as if it were any other 902 # After the initial checkout, we can use update as if it were any other
901 # dep. 903 # dep.
902 self.update(options, args, file_list) 904 self.update(options, args, file_list)
903 else: 905 else:
904 # If the installed version of SVN doesn't support --depth, fallback to 906 # If the installed version of SVN doesn't support --depth, fallback to
905 # just exporting the file. This has the downside that revision 907 # just exporting the file. This has the downside that revision
906 # information is not stored next to the file, so we will have to 908 # information is not stored next to the file, so we will have to
907 # re-export the file every time we sync. 909 # re-export the file every time we sync.
908 if not os.path.exists(self.checkout_path): 910 if not os.path.exists(self.checkout_path):
909 os.makedirs(self.checkout_path) 911 gclient_utils.safe_makedirs(self.checkout_path)
910 command = ["export", os.path.join(self.url, filename), 912 command = ["export", os.path.join(self.url, filename),
911 os.path.join(self.checkout_path, filename)] 913 os.path.join(self.checkout_path, filename)]
912 command = self._AddAdditionalUpdateFlags(command, options, 914 command = self._AddAdditionalUpdateFlags(command, options,
913 options.revision) 915 options.revision)
914 self._Run(command, options, cwd=self._root_dir) 916 self._Run(command, options, cwd=self._root_dir)
915 917
916 def revert(self, options, args, file_list): 918 def revert(self, options, args, file_list):
917 """Reverts local modifications. Subversion specific. 919 """Reverts local modifications. Subversion specific.
918 920
919 All reverted files will be appended to file_list, even if Subversion 921 All reverted files will be appended to file_list, even if Subversion
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 new_command.append('--force') 1028 new_command.append('--force')
1027 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1029 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1028 new_command.extend(('--accept', 'theirs-conflict')) 1030 new_command.extend(('--accept', 'theirs-conflict'))
1029 elif options.manually_grab_svn_rev: 1031 elif options.manually_grab_svn_rev:
1030 new_command.append('--force') 1032 new_command.append('--force')
1031 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1033 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1032 new_command.extend(('--accept', 'postpone')) 1034 new_command.extend(('--accept', 'postpone'))
1033 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1035 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1034 new_command.extend(('--accept', 'postpone')) 1036 new_command.extend(('--accept', 'postpone'))
1035 return new_command 1037 return new_command
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698