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

Side by Side Diff: gclient_scm.py

Issue 1063973002: Fix hook disable logic in gclient_scm (non-atomic os.rename on Windows) (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 if file_list is not None: 311 if file_list is not None:
312 files = self._Capture(['ls-files']).splitlines() 312 files = self._Capture(['ls-files']).splitlines()
313 file_list.extend([os.path.join(self.checkout_path, f) for f in files]) 313 file_list.extend([os.path.join(self.checkout_path, f) for f in files])
314 314
315 def _DisableHooks(self): 315 def _DisableHooks(self):
316 hook_dir = os.path.join(self.checkout_path, '.git', 'hooks') 316 hook_dir = os.path.join(self.checkout_path, '.git', 'hooks')
317 if not os.path.isdir(hook_dir): 317 if not os.path.isdir(hook_dir):
318 return 318 return
319 for f in os.listdir(hook_dir): 319 for f in os.listdir(hook_dir):
320 if not f.endswith('.sample') and not f.endswith('.disabled'): 320 if not f.endswith('.sample') and not f.endswith('.disabled'):
321 os.rename(os.path.join(hook_dir, f), 321 disabled_hook_path = os.path.join(hook_dir, f + '.disabled')
322 os.path.join(hook_dir, f + '.disabled')) 322 if os.path.exists(disabled_hook_path):
323 os.remove(disabled_hook_path)
324 os.rename(os.path.join(hook_dir, f), disabled_hook_path)
323 325
324 def update(self, options, args, file_list): 326 def update(self, options, args, file_list):
325 """Runs git to update or transparently checkout the working copy. 327 """Runs git to update or transparently checkout the working copy.
326 328
327 All updated files will be appended to file_list. 329 All updated files will be appended to file_list.
328 330
329 Raises: 331 Raises:
330 Error: if can't get URL for relative path. 332 Error: if can't get URL for relative path.
331 """ 333 """
332 if args: 334 if args:
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 new_command.append('--force') 1625 new_command.append('--force')
1624 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1626 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1625 new_command.extend(('--accept', 'theirs-conflict')) 1627 new_command.extend(('--accept', 'theirs-conflict'))
1626 elif options.manually_grab_svn_rev: 1628 elif options.manually_grab_svn_rev:
1627 new_command.append('--force') 1629 new_command.append('--force')
1628 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1630 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1629 new_command.extend(('--accept', 'postpone')) 1631 new_command.extend(('--accept', 'postpone'))
1630 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1632 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1631 new_command.extend(('--accept', 'postpone')) 1633 new_command.extend(('--accept', 'postpone'))
1632 return new_command 1634 return new_command
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698