~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/knitrepo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-13 14:20:03 UTC
  • mfrom: (4599.2.4 windows-installer)
  • Revision ID: pqm@pqm.ubuntu.com-20090813142003-3x748ymw3avzmme7
(jam) Updates to the windows installers.

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):
428
424
        """See RepositoryFormat.get_format_description()."""
429
425
        return "Knit repository format 1"
430
426
 
 
427
    def check_conversion_target(self, target_format):
 
428
        pass
 
429
 
431
430
 
432
431
class RepositoryFormatKnit3(RepositoryFormatKnit):
433
432
    """Bzr repository knit format 3.
448
447
    repository_class = KnitRepository
449
448
    _commit_builder_class = RootCommitBuilder
450
449
    rich_root_data = True
451
 
    experimental = True
452
450
    supports_tree_reference = True
453
451
    @property
454
452
    def _serializer(self):
462
460
 
463
461
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
464
462
 
 
463
    def check_conversion_target(self, target_format):
 
464
        if not target_format.rich_root_data:
 
465
            raise errors.BadConversionTarget(
 
466
                'Does not support rich root data.', target_format)
 
467
        if not getattr(target_format, 'supports_tree_reference', False):
 
468
            raise errors.BadConversionTarget(
 
469
                'Does not support nested trees', target_format)
 
470
 
465
471
    def get_format_string(self):
466
472
        """See RepositoryFormat.get_format_string()."""
467
473
        return "Bazaar Knit Repository Format 3 (bzr 0.15)\n"
503
509
 
504
510
    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
505
511
 
 
512
    def check_conversion_target(self, target_format):
 
513
        if not target_format.rich_root_data:
 
514
            raise errors.BadConversionTarget(
 
515
                'Does not support rich root data.', target_format)
 
516
 
506
517
    def get_format_string(self):
507
518
        """See RepositoryFormat.get_format_string()."""
508
519
        return 'Bazaar Knit Repository Format 4 (bzr 1.0)\n'