~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: John Arbash Meinel
  • Date: 2010-01-12 22:51:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4955.
  • Revision ID: john@arbash-meinel.com-20100112225131-he8h411p6aeeb947
Delay grabbing an output stream until we actually go to show a diff.

This makes the test suite happy, but it also seems to be reasonable.
If we aren't going to write anything, we don't need to hold an
output stream open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
39
39
    lockdir,
40
40
    osutils,
41
41
    revision as _mod_revision,
42
 
    trace,
43
42
    urlutils,
44
43
    versionedfile,
45
44
    weave,
54
53
    RepositoryFormat,
55
54
    )
56
55
from bzrlib.store.text import TextStore
 
56
from bzrlib.trace import mutter
57
57
from bzrlib.tuned_gzip import GzipFile, bytes_to_gzip
58
58
from bzrlib.versionedfile import (
59
59
    AbsentContentFactory,
106
106
    def _all_possible_ids(self):
107
107
        """Return all the possible revisions that we could find."""
108
108
        if 'evil' in debug.debug_flags:
109
 
            trace.mutter_callsite(
110
 
                3, "_all_possible_ids scales with size of history.")
 
109
            mutter_callsite(3, "_all_possible_ids scales with size of history.")
111
110
        return [key[-1] for key in self.inventories.keys()]
112
111
 
113
112
    @needs_read_lock
177
176
        :param new_value: True to restore the default, False to disable making
178
177
                          working trees.
179
178
        """
180
 
        raise errors.RepositoryUpgradeRequired(self.user_url)
 
179
        raise errors.RepositoryUpgradeRequired(self.bzrdir.root_transport.base)
181
180
 
182
181
    def make_working_trees(self):
183
182
        """Returns the policy for making working trees on new branches."""
200
199
    def _all_possible_ids(self):
201
200
        """Return all the possible revisions that we could find."""
202
201
        if 'evil' in debug.debug_flags:
203
 
            trace.mutter_callsite(
204
 
                3, "_all_possible_ids scales with size of history.")
 
202
            mutter_callsite(3, "_all_possible_ids scales with size of history.")
205
203
        return [key[-1] for key in self.inventories.keys()]
206
204
 
207
205
    @needs_read_lock
288
286
        weavefile.write_weave_v5(weave.Weave(), sio)
289
287
        empty_weave = sio.getvalue()
290
288
 
291
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
289
        mutter('creating repository in %s.', a_bzrdir.transport.base)
292
290
 
293
291
        # FIXME: RBC 20060125 don't peek under the covers
294
292
        # NB: no need to escape relative paths that are url safe.
304
302
                mode=a_bzrdir._get_file_mode())
305
303
        finally:
306
304
            control_files.unlock()
307
 
        repository = self.open(a_bzrdir, _found=True)
308
 
        self._run_post_repo_init_hooks(repository, a_bzrdir, shared)
309
 
        return repository
 
305
        return self.open(a_bzrdir, _found=True)
310
306
 
311
307
    def open(self, a_bzrdir, _found=False):
312
308
        """See RepositoryFormat.open()."""
528
524
        weavefile.write_weave_v5(weave.Weave(), sio)
529
525
        empty_weave = sio.getvalue()
530
526
 
531
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
527
        mutter('creating repository in %s.', a_bzrdir.transport.base)
532
528
        dirs = ['revision-store', 'weaves']
533
529
        files = [('inventory.weave', StringIO(empty_weave)),
534
530
                 ]