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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 def enqueue(self, d): | 791 def enqueue(self, d): |
792 """Enqueue one Dependency to be executed later once its requirements are | 792 """Enqueue one Dependency to be executed later once its requirements are |
793 satisfied. | 793 satisfied. |
794 """ | 794 """ |
795 assert isinstance(d, WorkItem) | 795 assert isinstance(d, WorkItem) |
796 self.ready_cond.acquire() | 796 self.ready_cond.acquire() |
797 try: | 797 try: |
798 self.queued.append(d) | 798 self.queued.append(d) |
799 total = len(self.queued) + len(self.ran) + len(self.running) | 799 total = len(self.queued) + len(self.ran) + len(self.running) |
| 800 if self.jobs == 1: |
| 801 total += 1 |
800 logging.debug('enqueued(%s)' % d.name) | 802 logging.debug('enqueued(%s)' % d.name) |
801 if self.progress: | 803 if self.progress: |
802 self.progress._total = total + 1 | 804 self.progress._total = total |
803 self.progress.update(0) | 805 self.progress.update(0) |
804 self.ready_cond.notifyAll() | 806 self.ready_cond.notifyAll() |
805 finally: | 807 finally: |
806 self.ready_cond.release() | 808 self.ready_cond.release() |
807 | 809 |
808 def out_cb(self, _): | 810 def out_cb(self, _): |
809 self.last_subproc_output = datetime.datetime.now() | 811 self.last_subproc_output = datetime.datetime.now() |
810 return True | 812 return True |
811 | 813 |
812 @staticmethod | 814 @staticmethod |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 def DefaultIndexPackConfig(url=''): | 1129 def DefaultIndexPackConfig(url=''): |
1128 """Return reasonable default values for configuring git-index-pack. | 1130 """Return reasonable default values for configuring git-index-pack. |
1129 | 1131 |
1130 Experiments suggest that higher values for pack.threads don't improve | 1132 Experiments suggest that higher values for pack.threads don't improve |
1131 performance.""" | 1133 performance.""" |
1132 cache_limit = DefaultDeltaBaseCacheLimit() | 1134 cache_limit = DefaultDeltaBaseCacheLimit() |
1133 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] | 1135 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] |
1134 if url in THREADED_INDEX_PACK_BLACKLIST: | 1136 if url in THREADED_INDEX_PACK_BLACKLIST: |
1135 result.extend(['-c', 'pack.threads=1']) | 1137 result.extend(['-c', 'pack.threads=1']) |
1136 return result | 1138 return result |
OLD | NEW |