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 """Generic utils.""" | 5 """Generic utils.""" |
6 | 6 |
7 import codecs | 7 import codecs |
8 import cStringIO | 8 import cStringIO |
9 import datetime | 9 import datetime |
10 import logging | 10 import logging |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 top_dir = [os.getcwd()] | 672 top_dir = [os.getcwd()] |
673 def filter_fn(line): | 673 def filter_fn(line): |
674 top_dir[0] = os.path.normpath(line.rstrip('\n')) | 674 top_dir[0] = os.path.normpath(line.rstrip('\n')) |
675 try: | 675 try: |
676 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], | 676 CheckCallAndFilter(["git", "rev-parse", "--show-toplevel"], |
677 print_stdout=False, filter_fn=filter_fn) | 677 print_stdout=False, filter_fn=filter_fn) |
678 except Exception: | 678 except Exception: |
679 pass | 679 pass |
680 top_dir = top_dir[0] | 680 top_dir = top_dir[0] |
681 if os.path.exists(os.path.join(top_dir, 'buildtools')): | 681 if os.path.exists(os.path.join(top_dir, 'buildtools')): |
682 return os.path.join(top_dir, 'buildtools') | 682 return top_dir |
683 return None | 683 return None |
684 | 684 |
685 # Some projects' top directory is not named 'src'. | 685 # Some projects' top directory is not named 'src'. |
686 source_dir_name = GetGClientPrimarySolutionName(gclient_root) or 'src' | 686 source_dir_name = GetGClientPrimarySolutionName(gclient_root) or 'src' |
687 return os.path.join(gclient_root, source_dir_name) | 687 return os.path.join(gclient_root, source_dir_name) |
688 | 688 |
689 | 689 |
690 def GetBuildtoolsPath(): | 690 def GetBuildtoolsPath(): |
691 """Returns the full path to the buildtools directory. | 691 """Returns the full path to the buildtools directory. |
692 This is based on the root of the checkout containing the current directory.""" | 692 This is based on the root of the checkout containing the current directory.""" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 def DefaultIndexPackConfig(url=''): | 1191 def DefaultIndexPackConfig(url=''): |
1192 """Return reasonable default values for configuring git-index-pack. | 1192 """Return reasonable default values for configuring git-index-pack. |
1193 | 1193 |
1194 Experiments suggest that higher values for pack.threads don't improve | 1194 Experiments suggest that higher values for pack.threads don't improve |
1195 performance.""" | 1195 performance.""" |
1196 cache_limit = DefaultDeltaBaseCacheLimit() | 1196 cache_limit = DefaultDeltaBaseCacheLimit() |
1197 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] | 1197 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] |
1198 if url in THREADED_INDEX_PACK_BLACKLIST: | 1198 if url in THREADED_INDEX_PACK_BLACKLIST: |
1199 result.extend(['-c', 'pack.threads=1']) | 1199 result.extend(['-c', 'pack.threads=1']) |
1200 return result | 1200 return result |
OLD | NEW |