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

Side by Side Diff: gclient_scm.py

Issue 14230012: Add placeholder git hooks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix THIS_FILE_PATH Created 7 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 | Annotate | Revision Log
« 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 import logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
11 import sys 11 import sys
12 import time 12 import time
13 13
14 import gclient_utils 14 import gclient_utils
15 import scm 15 import scm
16 import subprocess2 16 import subprocess2
17 17
18 18
19 THIS_FILE_PATH = os.path.abspath(__file__)
20
21
19 class DiffFiltererWrapper(object): 22 class DiffFiltererWrapper(object):
20 """Simple base class which tracks which file is being diffed and 23 """Simple base class which tracks which file is being diffed and
21 replaces instances of its file name in the original and 24 replaces instances of its file name in the original and
22 working copy lines of the svn/git diff output.""" 25 working copy lines of the svn/git diff output."""
23 index_string = None 26 index_string = None
24 original_prefix = "--- " 27 original_prefix = "--- "
25 working_prefix = "+++ " 28 working_prefix = "+++ "
26 29
27 def __init__(self, relpath): 30 def __init__(self, relpath):
28 # Note that we always use '/' as the path separator to be 31 # Note that we always use '/' as the path separator to be
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 649
647 Once we've cloned the repo, we checkout a working branch if the specified 650 Once we've cloned the repo, we checkout a working branch if the specified
648 revision is a branch head. If it is a tag or a specific commit, then we 651 revision is a branch head. If it is a tag or a specific commit, then we
649 leave HEAD detached as it makes future updates simpler -- in this case the 652 leave HEAD detached as it makes future updates simpler -- in this case the
650 user should first create a new branch or switch to an existing branch before 653 user should first create a new branch or switch to an existing branch before
651 making changes in the repo.""" 654 making changes in the repo."""
652 if not options.verbose: 655 if not options.verbose:
653 # git clone doesn't seem to insert a newline properly before printing 656 # git clone doesn't seem to insert a newline properly before printing
654 # to stdout 657 # to stdout
655 print('') 658 print('')
656 659 template_path = os.path.join(
657 clone_cmd = ['clone', '--progress'] 660 os.path.dirname(THIS_FILE_PATH), 'git-templates')
661 clone_cmd = ['clone', '--progress', '--template=%s' % template_path]
658 if revision.startswith('refs/heads/'): 662 if revision.startswith('refs/heads/'):
659 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')]) 663 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')])
660 detach_head = False 664 detach_head = False
661 else: 665 else:
662 detach_head = True 666 detach_head = True
663 if options.verbose: 667 if options.verbose:
664 clone_cmd.append('--verbose') 668 clone_cmd.append('--verbose')
665 clone_cmd.extend([url, self.checkout_path]) 669 clone_cmd.extend([url, self.checkout_path])
666 670
667 # If the parent directory does not exist, Git clone on Windows will not 671 # If the parent directory does not exist, Git clone on Windows will not
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 new_command.append('--force') 1262 new_command.append('--force')
1259 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1263 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1260 new_command.extend(('--accept', 'theirs-conflict')) 1264 new_command.extend(('--accept', 'theirs-conflict'))
1261 elif options.manually_grab_svn_rev: 1265 elif options.manually_grab_svn_rev:
1262 new_command.append('--force') 1266 new_command.append('--force')
1263 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1267 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1264 new_command.extend(('--accept', 'postpone')) 1268 new_command.extend(('--accept', 'postpone'))
1265 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: 1269 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]:
1266 new_command.extend(('--accept', 'postpone')) 1270 new_command.extend(('--accept', 'postpone'))
1267 return new_command 1271 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