Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 = __file__ | |
|
M-A Ruel
2013/04/19 19:28:58
THIS_FILE_PATH = os.path.abspath(__file__)
becaus
szager
2013/04/19 20:12:13
Done.
| |
| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 | 648 |
| 646 Once we've cloned the repo, we checkout a working branch if the specified | 649 Once we've cloned the repo, we checkout a working branch if the specified |
| 647 revision is a branch head. If it is a tag or a specific commit, then we | 650 revision is a branch head. If it is a tag or a specific commit, then we |
| 648 leave HEAD detached as it makes future updates simpler -- in this case the | 651 leave HEAD detached as it makes future updates simpler -- in this case the |
| 649 user should first create a new branch or switch to an existing branch before | 652 user should first create a new branch or switch to an existing branch before |
| 650 making changes in the repo.""" | 653 making changes in the repo.""" |
| 651 if not options.verbose: | 654 if not options.verbose: |
| 652 # git clone doesn't seem to insert a newline properly before printing | 655 # git clone doesn't seem to insert a newline properly before printing |
| 653 # to stdout | 656 # to stdout |
| 654 print('') | 657 print('') |
| 655 | 658 template_path = os.path.abspath( |
| 656 clone_cmd = ['clone', '--progress'] | 659 os.path.join(os.path.dirname(THIS_FILE_PATH), 'git-templates')) |
| 660 clone_cmd = ['clone', '--progress', '--template=%s' % template_path] | |
| 657 if revision.startswith('refs/heads/'): | 661 if revision.startswith('refs/heads/'): |
| 658 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')]) | 662 clone_cmd.extend(['-b', revision.replace('refs/heads/', '')]) |
| 659 detach_head = False | 663 detach_head = False |
| 660 else: | 664 else: |
| 661 detach_head = True | 665 detach_head = True |
| 662 if options.verbose: | 666 if options.verbose: |
| 663 clone_cmd.append('--verbose') | 667 clone_cmd.append('--verbose') |
| 664 clone_cmd.extend([url, self.checkout_path]) | 668 clone_cmd.extend([url, self.checkout_path]) |
| 665 | 669 |
| 666 # If the parent directory does not exist, Git clone on Windows will not | 670 # 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 Loading... | |
| 1257 new_command.append('--force') | 1261 new_command.append('--force') |
| 1258 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1262 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1259 new_command.extend(('--accept', 'theirs-conflict')) | 1263 new_command.extend(('--accept', 'theirs-conflict')) |
| 1260 elif options.manually_grab_svn_rev: | 1264 elif options.manually_grab_svn_rev: |
| 1261 new_command.append('--force') | 1265 new_command.append('--force') |
| 1262 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1266 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1263 new_command.extend(('--accept', 'postpone')) | 1267 new_command.extend(('--accept', 'postpone')) |
| 1264 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1268 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
| 1265 new_command.extend(('--accept', 'postpone')) | 1269 new_command.extend(('--accept', 'postpone')) |
| 1266 return new_command | 1270 return new_command |
| OLD | NEW |