/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/repofmt/knitrepo.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 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
24
24
    lockdir,
25
25
    osutils,
26
26
    revision as _mod_revision,
27
 
    trace,
28
27
    transactions,
29
28
    versionedfile,
30
29
    xml5,
38
37
from bzrlib.decorators import needs_read_lock, needs_write_lock
39
38
from bzrlib.repository import (
40
39
    CommitBuilder,
41
 
    IsInWriteGroupError,
42
40
    MetaDirRepository,
43
41
    MetaDirRepositoryFormat,
44
42
    RepositoryFormat,
45
43
    RootCommitBuilder,
46
44
    )
 
45
from bzrlib.trace import mutter, mutter_callsite
47
46
 
48
47
 
49
48
class _KnitParentsProvider(object):
211
210
    def _refresh_data(self):
212
211
        if not self.is_locked():
213
212
            return
214
 
        if self.is_in_write_group():
215
 
            raise IsInWriteGroupError(self)
216
213
        # Create a new transaction to force all knits to see the scope change.
217
214
        # This is safe because we're outside a write group.
218
215
        self.control_files._finish_transaction()
345
342
        :param shared: If true the repository will be initialized as a shared
346
343
                       repository.
347
344
        """
348
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
345
        mutter('creating repository in %s.', a_bzrdir.transport.base)
349
346
        dirs = ['knits']
350
347
        files = []
351
348
        utf8_files = [('format', self.get_format_string())]
363
360
        result.revisions.get_parent_map([('A',)])
364
361
        result.signatures.get_parent_map([('A',)])
365
362
        result.unlock()
366
 
        self._run_post_repo_init_hooks(result, a_bzrdir, shared)
367
363
        return result
368
364
 
369
365
    def open(self, a_bzrdir, _found=False, _override_transport=None):
448
444
    repository_class = KnitRepository
449
445
    _commit_builder_class = RootCommitBuilder
450
446
    rich_root_data = True
451
 
    experimental = True
452
447
    supports_tree_reference = True
453
448
    @property
454
449
    def _serializer(self):