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

Side by Side Diff: gclient_scm.py

Issue 348703002: Remove hooks until Windows performance issues are sorted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 6 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 | tests/gclient_scm_test.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) 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 from __future__ import print_function 7 from __future__ import print_function
8 8
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 self._UpdateBranchHeads(options, fetch=False) 301 self._UpdateBranchHeads(options, fetch=False)
302 302
303 cfg = gclient_utils.DefaultIndexPackConfig(self.url) 303 cfg = gclient_utils.DefaultIndexPackConfig(self.url)
304 fetch_cmd = cfg + ['fetch', self.remote, '--prune'] 304 fetch_cmd = cfg + ['fetch', self.remote, '--prune']
305 self._Run(fetch_cmd + quiet, options, retry=True) 305 self._Run(fetch_cmd + quiet, options, retry=True)
306 self._Run(['reset', '--hard', revision] + quiet, options) 306 self._Run(['reset', '--hard', revision] + quiet, options)
307 if file_list is not None: 307 if file_list is not None:
308 files = self._Capture(['ls-files']).splitlines() 308 files = self._Capture(['ls-files']).splitlines()
309 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 309 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
310 310
311 def _DisableHooks(self):
312 hook_dir = os.path.join(self.checkout_path, '.git', 'hooks')
313 if not os.path.isdir(hook_dir):
314 return
315 for f in os.listdir(hook_dir):
316 if not f.endswith('.sample') and not f.endswith('.disabled'):
317 os.rename(os.path.join(hook_dir, f),
318 os.path.join(hook_dir, f + '.disabled'))
319
311 def update(self, options, args, file_list): 320 def update(self, options, args, file_list):
312 """Runs git to update or transparently checkout the working copy. 321 """Runs git to update or transparently checkout the working copy.
313 322
314 All updated files will be appended to file_list. 323 All updated files will be appended to file_list.
315 324
316 Raises: 325 Raises:
317 Error: if can't get URL for relative path. 326 Error: if can't get URL for relative path.
318 """ 327 """
319 if args: 328 if args:
320 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args)) 329 raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
(...skipping 10 matching lines...) Expand all
331 # Override the revision number. 340 # Override the revision number.
332 revision = str(options.revision) 341 revision = str(options.revision)
333 if revision == 'unmanaged': 342 if revision == 'unmanaged':
334 # Check again for a revision in case an initial ref was specified 343 # Check again for a revision in case an initial ref was specified
335 # in the url, for example bla.git@refs/heads/custombranch 344 # in the url, for example bla.git@refs/heads/custombranch
336 revision = deps_revision 345 revision = deps_revision
337 managed = False 346 managed = False
338 if not revision: 347 if not revision:
339 revision = default_rev 348 revision = default_rev
340 349
350 if managed:
351 self._DisableHooks()
352
341 if gclient_utils.IsDateRevision(revision): 353 if gclient_utils.IsDateRevision(revision):
342 # Date-revisions only work on git-repositories if the reflog hasn't 354 # Date-revisions only work on git-repositories if the reflog hasn't
343 # expired yet. Use rev-list to get the corresponding revision. 355 # expired yet. Use rev-list to get the corresponding revision.
344 # git rev-list -n 1 --before='time-stamp' branchname 356 # git rev-list -n 1 --before='time-stamp' branchname
345 if options.transitive: 357 if options.transitive:
346 self.Print('Warning: --transitive only works for SVN repositories.') 358 self.Print('Warning: --transitive only works for SVN repositories.')
347 revision = default_rev 359 revision = default_rev
348 360
349 rev_str = ' at %s' % revision 361 rev_str = ' at %s' % revision
350 files = [] if file_list is not None else None 362 files = [] if file_list is not None else None
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 801
790 Once we've cloned the repo, we checkout a working branch if the specified 802 Once we've cloned the repo, we checkout a working branch if the specified
791 revision is a branch head. If it is a tag or a specific commit, then we 803 revision is a branch head. If it is a tag or a specific commit, then we
792 leave HEAD detached as it makes future updates simpler -- in this case the 804 leave HEAD detached as it makes future updates simpler -- in this case the
793 user should first create a new branch or switch to an existing branch before 805 user should first create a new branch or switch to an existing branch before
794 making changes in the repo.""" 806 making changes in the repo."""
795 if not options.verbose: 807 if not options.verbose:
796 # git clone doesn't seem to insert a newline properly before printing 808 # git clone doesn't seem to insert a newline properly before printing
797 # to stdout 809 # to stdout
798 self.Print('') 810 self.Print('')
799 template_path = os.path.join(
800 os.path.dirname(THIS_FILE_PATH), 'git-templates')
801 cfg = gclient_utils.DefaultIndexPackConfig(url) 811 cfg = gclient_utils.DefaultIndexPackConfig(url)
802 clone_cmd = cfg + [ 812 clone_cmd = cfg + ['clone', '--no-checkout', '--progress']
803 'clone', '--no-checkout', '--progress', '--template=%s' % template_path]
804 if self.cache_dir: 813 if self.cache_dir:
805 clone_cmd.append('--shared') 814 clone_cmd.append('--shared')
806 if options.verbose: 815 if options.verbose:
807 clone_cmd.append('--verbose') 816 clone_cmd.append('--verbose')
808 clone_cmd.append(url) 817 clone_cmd.append(url)
809 # If the parent directory does not exist, Git clone on Windows will not 818 # If the parent directory does not exist, Git clone on Windows will not
810 # create it, so we need to do it manually. 819 # create it, so we need to do it manually.
811 parent_dir = os.path.dirname(self.checkout_path) 820 parent_dir = os.path.dirname(self.checkout_path)
812 gclient_utils.safe_makedirs(parent_dir) 821 gclient_utils.safe_makedirs(parent_dir)
813 tmp_dir = tempfile.mkdtemp( 822 tmp_dir = tempfile.mkdtemp(
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 new_command.append('--force') 1498 new_command.append('--force')
1490 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1499 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1491 new_command.extend(('--accept', 'theirs-conflict')) 1500 new_command.extend(('--accept', 'theirs-conflict'))
1492 elif options.manually_grab_svn_rev: 1501 elif options.manually_grab_svn_rev:
1493 new_command.append('--force') 1502 new_command.append('--force')
1494 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1503 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1495 new_command.extend(('--accept', 'postpone')) 1504 new_command.extend(('--accept', 'postpone'))
1496 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1505 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1497 new_command.extend(('--accept', 'postpone')) 1506 new_command.extend(('--accept', 'postpone'))
1498 return new_command 1507 return new_command
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698