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 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 11 matching lines...) Expand all Loading... | |
22 import scm | 22 import scm |
23 import shutil | 23 import shutil |
24 import subprocess2 | 24 import subprocess2 |
25 | 25 |
26 | 26 |
27 THIS_FILE_PATH = os.path.abspath(__file__) | 27 THIS_FILE_PATH = os.path.abspath(__file__) |
28 | 28 |
29 GSUTIL_DEFAULT_PATH = os.path.join( | 29 GSUTIL_DEFAULT_PATH = os.path.join( |
30 os.path.dirname(os.path.abspath(__file__)), 'gsutil.py') | 30 os.path.dirname(os.path.abspath(__file__)), 'gsutil.py') |
31 | 31 |
32 CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src.git' | 32 |
33 class DiffFiltererWrapper(object): | 33 class DiffFiltererWrapper(object): |
34 """Simple base class which tracks which file is being diffed and | 34 """Simple base class which tracks which file is being diffed and |
35 replaces instances of its file name in the original and | 35 replaces instances of its file name in the original and |
36 working copy lines of the svn/git diff output.""" | 36 working copy lines of the svn/git diff output.""" |
37 index_string = None | 37 index_string = None |
38 original_prefix = "--- " | 38 original_prefix = "--- " |
39 working_prefix = "+++ " | 39 working_prefix = "+++ " |
40 | 40 |
41 def __init__(self, relpath, print_func): | 41 def __init__(self, relpath, print_func): |
42 # Note that we always use '/' as the path separator to be | 42 # Note that we always use '/' as the path separator to be |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 'old_' + self.relpath.replace(os.sep, '_')) + '.git' | 823 'old_' + self.relpath.replace(os.sep, '_')) + '.git' |
824 | 824 |
825 def _GetMirror(self, url, options): | 825 def _GetMirror(self, url, options): |
826 """Get a git_cache.Mirror object for the argument url.""" | 826 """Get a git_cache.Mirror object for the argument url.""" |
827 if not git_cache.Mirror.GetCachePath(): | 827 if not git_cache.Mirror.GetCachePath(): |
828 return None | 828 return None |
829 mirror_kwargs = { | 829 mirror_kwargs = { |
830 'print_func': self.filter, | 830 'print_func': self.filter, |
831 'refs': [] | 831 'refs': [] |
832 } | 832 } |
833 # TODO(hinoka): This currently just fails because lkcr/lkgr are branches | |
834 # not tags. This also adds 20 seconds to every bot_update | |
835 # run, so I'm commenting this out until lkcr/lkgr become | |
836 # tags. (2014/4/24) | |
837 # if url == CHROMIUM_SRC_URL or url + '.git' == CHROMIUM_SRC_URL: | |
838 # mirror_kwargs['refs'].extend(['refs/tags/lkgr', 'refs/tags/lkcr']) | |
839 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: | 833 if hasattr(options, 'with_branch_heads') and options.with_branch_heads: |
840 mirror_kwargs['refs'].append('refs/branch-heads/*') | 834 mirror_kwargs['refs'].append('refs/branch-heads/*') |
841 if hasattr(options, 'with_tags') and options.with_tags: | 835 if hasattr(options, 'with_tags') and options.with_tags: |
842 mirror_kwargs['refs'].append('refs/tags/*') | 836 mirror_kwargs['refs'].append('refs/tags/*') |
843 return git_cache.Mirror(url, **mirror_kwargs) | 837 return git_cache.Mirror(url, **mirror_kwargs) |
844 | 838 |
845 @staticmethod | 839 @staticmethod |
846 def _UpdateMirror(mirror, options): | 840 def _UpdateMirror(mirror, options): |
847 """Update a git mirror by fetching the latest commits from the remote.""" | 841 """Update a git mirror by fetching the latest commits from the remote.""" |
848 if getattr(options, 'shallow', False): | 842 if getattr(options, 'shallow', False): |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1161 cmd = ['git'] + args | 1155 cmd = ['git'] + args |
1162 if show_header: | 1156 if show_header: |
1163 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs) | 1157 gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs) |
1164 else: | 1158 else: |
1165 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) | 1159 gclient_utils.CheckCallAndFilter(cmd, env=env, **kwargs) |
1166 | 1160 |
1167 | 1161 |
1168 class SVNWrapper(SCMWrapper): | 1162 class SVNWrapper(SCMWrapper): |
1169 """ Wrapper for SVN """ | 1163 """ Wrapper for SVN """ |
1170 name = 'svn' | 1164 name = 'svn' |
1165 _USED = False | |
1166 | |
1167 _MESSAGE = ( | |
1168 'Oh hai! You are using subversion. Chrome infra is eager love to get rid', | |
iannucci
2015/05/26 21:35:54
s/love//
M-A Ruel
2015/05/27 00:50:00
Done.
| |
1169 'of svn support so please switch to git.', | |
1170 'Tracking bug: http://crbug.com/475320', | |
1171 'Request a new git repository at: ', | |
1172 ' https://code.google.com/p/chromium/issues/entry?template=Infra-Git', | |
1173 '', | |
1174 'If subversion support is needed, pin your depot_tools to ', | |
1175 'c20f470011e2ea4d81527976f3bded2c13e258af and set the env var', | |
1176 'DEPOT_TOOLS_UPDATE=0', | |
1177 'Thank you for your business!') | |
1178 | |
1179 def __init__(self, *args, **kwargs): | |
1180 super(SVNWrapper, self).__init__(*args, **kwargs) | |
1181 if SVNWrapper._USED: | |
iannucci
2015/05/26 21:35:54
won't this be always-False?
I think you want `if
M-A Ruel
2015/05/27 00:50:00
Done.
| |
1182 SVNWrapper._USED = True | |
1183 sys.stderr.write('\n'.join(self._MESSAGE) + '\n') | |
1171 | 1184 |
1172 @staticmethod | 1185 @staticmethod |
1173 def BinaryExists(): | 1186 def BinaryExists(): |
1174 """Returns true if the command exists.""" | 1187 """Returns true if the command exists.""" |
1175 try: | 1188 try: |
1176 result, version = scm.SVN.AssertVersion('1.4') | 1189 result, version = scm.SVN.AssertVersion('1.4') |
1177 if not result: | 1190 if not result: |
1178 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) | 1191 raise gclient_utils.Error('SVN version is older than 1.4: %s' % version) |
1179 return result | 1192 return result |
1180 except OSError: | 1193 except OSError: |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1627 new_command.append('--force') | 1640 new_command.append('--force') |
1628 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1641 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1629 new_command.extend(('--accept', 'theirs-conflict')) | 1642 new_command.extend(('--accept', 'theirs-conflict')) |
1630 elif options.manually_grab_svn_rev: | 1643 elif options.manually_grab_svn_rev: |
1631 new_command.append('--force') | 1644 new_command.append('--force') |
1632 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1645 if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1633 new_command.extend(('--accept', 'postpone')) | 1646 new_command.extend(('--accept', 'postpone')) |
1634 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: | 1647 elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: |
1635 new_command.extend(('--accept', 'postpone')) | 1648 new_command.extend(('--accept', 'postpone')) |
1636 return new_command | 1649 return new_command |
OLD | NEW |