From 8a13970ea21b65c57be360c35d09996bd332259c Mon Sep 17 00:00:00 2001 From: "szager@chromium.org" Date: Fri, 20 Jun 2014 15:55:01 +0000 Subject: [PATCH] Remove hooks until Windows performance issues are sorted. R=iannucci@chromium.org,hinoka@chromium.org BUG= Review URL: https://codereview.chromium.org/348703002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@278717 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_scm.py | 17 +++++++++++++---- tests/gclient_scm_test.py | 4 ++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gclient_scm.py b/gclient_scm.py index 67d68674e..a9a3019b6 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -308,6 +308,15 @@ class GitWrapper(SCMWrapper): files = self._Capture(['ls-files']).splitlines() file_list.extend([os.path.join(self.checkout_path, f) for f in files]) + def _DisableHooks(self): + hook_dir = os.path.join(self.checkout_path, '.git', 'hooks') + if not os.path.isdir(hook_dir): + return + for f in os.listdir(hook_dir): + if not f.endswith('.sample') and not f.endswith('.disabled'): + os.rename(os.path.join(hook_dir, f), + os.path.join(hook_dir, f + '.disabled')) + def update(self, options, args, file_list): """Runs git to update or transparently checkout the working copy. @@ -338,6 +347,9 @@ class GitWrapper(SCMWrapper): if not revision: revision = default_rev + if managed: + self._DisableHooks() + if gclient_utils.IsDateRevision(revision): # Date-revisions only work on git-repositories if the reflog hasn't # expired yet. Use rev-list to get the corresponding revision. @@ -796,11 +808,8 @@ class GitWrapper(SCMWrapper): # git clone doesn't seem to insert a newline properly before printing # to stdout self.Print('') - template_path = os.path.join( - os.path.dirname(THIS_FILE_PATH), 'git-templates') cfg = gclient_utils.DefaultIndexPackConfig(url) - clone_cmd = cfg + [ - 'clone', '--no-checkout', '--progress', '--template=%s' % template_path] + clone_cmd = cfg + ['clone', '--no-checkout', '--progress'] if self.cache_dir: clone_cmd.append('--shared') if options.verbose: diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 55bc9c365..e91b48c4d 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -1322,6 +1322,8 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): def testUpdateNoDotGit(self): options = self.Options() + gclient_scm.os.path.isdir( + os.path.join(self.base_path, '.git', 'hooks')).AndReturn(False) gclient_scm.os.path.exists(self.base_path).AndReturn(True) gclient_scm.os.path.isdir(self.base_path).AndReturn(True) gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') @@ -1350,6 +1352,8 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): def testUpdateConflict(self): options = self.Options() + gclient_scm.os.path.isdir( + os.path.join(self.base_path, '.git', 'hooks')).AndReturn(False) gclient_scm.os.path.exists(self.base_path).AndReturn(True) gclient_scm.os.path.isdir(self.base_path).AndReturn(True) gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')