/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/pack_repo.py

Merge up bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 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
60
60
    CommitBuilder,
61
61
    MetaDirRepository,
62
62
    MetaDirRepositoryFormat,
 
63
    RepositoryFormat,
63
64
    RootCommitBuilder,
64
65
    )
65
66
import bzrlib.revision as _mod_revision
66
67
from bzrlib.store.revision.knit import KnitRevisionStore
67
68
from bzrlib.store.versioned import VersionedFileStore
68
 
from bzrlib.trace import mutter, note, warning
 
69
from bzrlib.trace import (
 
70
    mutter,
 
71
    mutter_callsite,
 
72
    note,
 
73
    warning,
 
74
    )
69
75
 
70
76
 
71
77
class PackCommitBuilder(CommitBuilder):
197
203
            signature_index)
198
204
        self.name = name
199
205
        self.pack_transport = pack_transport
200
 
        assert None not in (revision_index, inventory_index, text_index,
201
 
            signature_index, name, pack_transport)
 
206
        if None in (revision_index, inventory_index, text_index,
 
207
                signature_index, name, pack_transport):
 
208
            raise AssertionError()
202
209
 
203
210
    def __eq__(self, other):
204
211
        return self.__dict__ == other.__dict__
321
328
 
322
329
    def access_tuple(self):
323
330
        """Return a tuple (transport, name) for the pack content."""
324
 
        assert self._state in ('open', 'finished')
325
331
        if self._state == 'finished':
326
332
            return Pack.access_tuple(self)
327
 
        else:
 
333
        elif self._state == 'open':
328
334
            return self.upload_transport, self.random_name
 
335
        else:
 
336
            raise AssertionError(self._state)
329
337
 
330
338
    def data_inserted(self):
331
339
        """True if data has been added to this pack."""
494
502
        :param index: An index from the pack parameter.
495
503
        :param pack: A Pack instance.
496
504
        """
497
 
        assert self.add_callback is None, \
498
 
            "%s already has a writable index through %s" % \
499
 
            (self, self.add_callback)
 
505
        if self.add_callback is not None:
 
506
            raise AssertionError(
 
507
                "%s already has a writable index through %s" % \
 
508
                (self, self.add_callback))
500
509
        # allow writing: queue writes to a new index
501
510
        self.add_index(index, pack)
502
511
        # Updates the index to packs mapping as a side effect,
1092
1101
        missing_text_keys = self.new_pack._external_compression_parents_of_texts()
1093
1102
        if missing_text_keys:
1094
1103
            raise errors.BzrError('Reference to missing compression parents %r'
1095
 
                % (refs - keys,))
 
1104
                % (missing_text_keys,))
1096
1105
        self._log_copied_texts()
1097
1106
 
1098
1107
    def _use_pack(self, new_pack):
1148
1157
        
1149
1158
        :param pack: A Pack object.
1150
1159
        """
1151
 
        assert pack.name not in self._packs_by_name
 
1160
        if pack.name in self._packs_by_name:
 
1161
            raise AssertionError()
1152
1162
        self.packs.append(pack)
1153
1163
        self._packs_by_name[pack.name] = pack
1154
1164
        self.revision_index.add_index(pack.revision_index, pack)
2113
2123
        """
2114
2124
        if not _found:
2115
2125
            format = RepositoryFormat.find_format(a_bzrdir)
2116
 
            assert format.__class__ ==  self.__class__
2117
2126
        if _override_transport is not None:
2118
2127
            repo_transport = _override_transport
2119
2128
        else: