/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/tree_creator/kernel_like.py

merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Tree creators for kernel-like trees"""
18
18
 
69
69
        return tree
70
70
 
71
71
    def _create_tree(self, root, in_cache=False):
72
 
        # a kernel tree has ~10000 and 500 directory, with most files around 
73
 
        # 3-4 levels deep. 
 
72
        # a kernel tree has ~10000 and 500 directory, with most files around
 
73
        # 3-4 levels deep.
74
74
        # we simulate this by three levels of dirs named 0-7, givin 512 dirs,
75
75
        # and 20 files each.
76
76
        files = []
195
195
            returns only an in-memory Inventory, so it should always be None.
196
196
        :return: An Inventory object.
197
197
        """
198
 
        assert root is None, "Cannot create a memory inventory in a on disk."
199
198
        cache_dir = self._get_cache_dir()
200
199
        if cache_dir is None:
201
200
            return self._create_and_return()
210
209
                                                 link_bzr=True,
211
210
                                                 hot_cache=False)
212
211
        tree = creator.create('.')
213
 
        return tree.basis_tree().inventory
 
212
        basis = tree.basis_tree()
 
213
        basis.lock_read()
 
214
        try:
 
215
            return basis.inventory
 
216
        finally:
 
217
            basis.unlock()
214
218
 
215
219
    def _open_cached(self, cache_dir):
216
220
        f = open(cache_dir + '/inventory', 'rb')