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

Side by Side Diff: gclient_scm.py

Issue 202753003: Rationalize the git config settings for index-pack performance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: comment Created 6 years, 9 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 | « fetch.py ('k') | gclient_utils.py » ('j') | gclient_utils.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 gclient_utils.CheckCallAndFilter(cmd4, **kwargs) 224 gclient_utils.CheckCallAndFilter(cmd4, **kwargs)
225 225
226 def _FetchAndReset(self, revision, file_list, options): 226 def _FetchAndReset(self, revision, file_list, options):
227 """Equivalent to git fetch; git reset.""" 227 """Equivalent to git fetch; git reset."""
228 quiet = [] 228 quiet = []
229 if not options.verbose: 229 if not options.verbose:
230 quiet = ['--quiet'] 230 quiet = ['--quiet']
231 self._UpdateBranchHeads(options, fetch=False) 231 self._UpdateBranchHeads(options, fetch=False)
232 232
233 fetch_cmd = [ 233 cfg = gclient_utils.DefaultIndexPackConfig()
234 '-c', 'core.deltaBaseCacheLimit=2g', 'fetch', self.remote, '--prune'] 234 fetch_cmd = cfg + ['fetch', self.remote, '--prune']
235 self._Run(fetch_cmd + quiet, options, retry=True) 235 self._Run(fetch_cmd + quiet, options, retry=True)
236 self._Run(['reset', '--hard', revision] + quiet, options) 236 self._Run(['reset', '--hard', revision] + quiet, options)
237 self.UpdateSubmoduleConfig() 237 self.UpdateSubmoduleConfig()
238 if file_list is not None: 238 if file_list is not None:
239 files = self._Capture(['ls-files']).splitlines() 239 files = self._Capture(['ls-files']).splitlines()
240 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 240 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
241 241
242 def update(self, options, args, file_list): 242 def update(self, options, args, file_list):
243 """Runs git to update or transparently checkout the working copy. 243 """Runs git to update or transparently checkout the working copy.
244 244
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 revision is a branch head. If it is a tag or a specific commit, then we 694 revision is a branch head. If it is a tag or a specific commit, then we
695 leave HEAD detached as it makes future updates simpler -- in this case the 695 leave HEAD detached as it makes future updates simpler -- in this case the
696 user should first create a new branch or switch to an existing branch before 696 user should first create a new branch or switch to an existing branch before
697 making changes in the repo.""" 697 making changes in the repo."""
698 if not options.verbose: 698 if not options.verbose:
699 # git clone doesn't seem to insert a newline properly before printing 699 # git clone doesn't seem to insert a newline properly before printing
700 # to stdout 700 # to stdout
701 print('') 701 print('')
702 template_path = os.path.join( 702 template_path = os.path.join(
703 os.path.dirname(THIS_FILE_PATH), 'git-templates') 703 os.path.dirname(THIS_FILE_PATH), 'git-templates')
704 clone_cmd = ['-c', 'core.deltaBaseCacheLimit=2g', 'clone', '--no-checkout', 704 cfg = gclient_utils.DefaultIndexPackConfig()
705 '--progress', '--template=%s' % template_path] 705 clone_cmd = cfg + [
706 'clone', '--no-checkout', '--progress', '--template=%s' % template_path]
706 if self.cache_dir: 707 if self.cache_dir:
707 clone_cmd.append('--shared') 708 clone_cmd.append('--shared')
708 if options.verbose: 709 if options.verbose:
709 clone_cmd.append('--verbose') 710 clone_cmd.append('--verbose')
710 clone_cmd.append(url) 711 clone_cmd.append(url)
711 # If the parent directory does not exist, Git clone on Windows will not 712 # If the parent directory does not exist, Git clone on Windows will not
712 # create it, so we need to do it manually. 713 # create it, so we need to do it manually.
713 parent_dir = os.path.dirname(self.checkout_path) 714 parent_dir = os.path.dirname(self.checkout_path)
714 gclient_utils.safe_makedirs(parent_dir) 715 gclient_utils.safe_makedirs(parent_dir)
715 tmp_dir = tempfile.mkdtemp( 716 tmp_dir = tempfile.mkdtemp(
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 cwd=cwd or self.checkout_path).strip() 906 cwd=cwd or self.checkout_path).strip()
906 907
907 def _UpdateBranchHeads(self, options, fetch=False): 908 def _UpdateBranchHeads(self, options, fetch=False):
908 """Adds, and optionally fetches, "branch-heads" refspecs if requested.""" 909 """Adds, and optionally fetches, "branch-heads" refspecs if requested."""
909 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: 910 if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
910 config_cmd = ['config', 'remote.%s.fetch' % self.remote, 911 config_cmd = ['config', 'remote.%s.fetch' % self.remote,
911 '+refs/branch-heads/*:refs/remotes/branch-heads/*', 912 '+refs/branch-heads/*:refs/remotes/branch-heads/*',
912 '^\\+refs/branch-heads/\\*:.*$'] 913 '^\\+refs/branch-heads/\\*:.*$']
913 self._Run(config_cmd, options) 914 self._Run(config_cmd, options)
914 if fetch: 915 if fetch:
915 fetch_cmd = ['-c', 'core.deltaBaseCacheLimit=2g', 'fetch', self.remote] 916 cfg = gclient_utils.DefaultIndexPackConfig()
917 fetch_cmd = cfg + ['fetch', self.remote]
916 if options.verbose: 918 if options.verbose:
917 fetch_cmd.append('--verbose') 919 fetch_cmd.append('--verbose')
918 self._Run(fetch_cmd, options, retry=True) 920 self._Run(fetch_cmd, options, retry=True)
919 921
920 def _Run(self, args, options, **kwargs): 922 def _Run(self, args, options, **kwargs):
921 kwargs.setdefault('cwd', self.checkout_path) 923 kwargs.setdefault('cwd', self.checkout_path)
922 git_filter = not options.verbose 924 git_filter = not options.verbose
923 if git_filter: 925 if git_filter:
924 kwargs['filter_fn'] = gclient_utils.GitFilter(kwargs.get('filter_fn')) 926 kwargs['filter_fn'] = gclient_utils.GitFilter(kwargs.get('filter_fn'))
925 kwargs.setdefault('print_stdout', False) 927 kwargs.setdefault('print_stdout', False)
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 new_command.append('--force') 1403 new_command.append('--force')
1402 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1404 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1403 new_command.extend(('--accept', 'theirs-conflict')) 1405 new_command.extend(('--accept', 'theirs-conflict'))
1404 elif options.manually_grab_svn_rev: 1406 elif options.manually_grab_svn_rev:
1405 new_command.append('--force') 1407 new_command.append('--force')
1406 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1408 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1407 new_command.extend(('--accept', 'postpone')) 1409 new_command.extend(('--accept', 'postpone'))
1408 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1410 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1409 new_command.extend(('--accept', 'postpone')) 1411 new_command.extend(('--accept', 'postpone'))
1410 return new_command 1412 return new_command
OLDNEW
« no previous file with comments | « fetch.py ('k') | gclient_utils.py » ('j') | gclient_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698