~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Aaron Bentley
  • Date: 2006-06-25 23:40:02 UTC
  • mto: This revision was merged to the branch mainline in revision 1813.
  • Revision ID: aaron.bentley@utoronto.ca-20060625234002-7e3ac9e115966213
Remove basis knit support

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
import operator
72
72
import os
73
73
import sys
 
74
import warnings
74
75
 
75
76
import bzrlib
76
77
import bzrlib.errors as errors
82
83
from bzrlib.osutils import contains_whitespace, contains_linebreaks, \
83
84
     sha_strings
84
85
from bzrlib.versionedfile import VersionedFile, InterVersionedFile
 
86
from bzrlib.symbol_versioning import DEPRECATED_PARAMETER, deprecated_passed
85
87
from bzrlib.tsort import topo_sort
86
88
import bzrlib.weave
87
89
 
271
273
    """
272
274
 
273
275
    def __init__(self, relpath, transport, file_mode=None, access_mode=None, 
274
 
                 factory=None, basis_knit=None, delta=True, create=False):
 
276
                 factory=None, basis_knit=DEPRECATED_PARAMETER, delta=True,
 
277
                 create=False):
275
278
        """Construct a knit at location specified by relpath.
276
279
        
277
280
        :param create: If not True, only open an existing knit.
278
281
        """
 
282
        if deprecated_passed(basis_knit):
 
283
            warnings.warn("KnitVersionedFile.__(): The basis_knit parameter is"
 
284
                 " deprecated as of bzr 0.9.",
 
285
                 DeprecationWarning, stacklevel=2)
279
286
        if access_mode is None:
280
287
            access_mode = 'w'
281
288
        super(KnitVersionedFile, self).__init__(access_mode)
282
289
        assert access_mode in ('r', 'w'), "invalid mode specified %r" % access_mode
283
 
        assert not basis_knit or isinstance(basis_knit, KnitVersionedFile), \
284
 
            type(basis_knit)
285
 
 
286
290
        self.transport = transport
287
291
        self.filename = relpath
288
 
        self.basis_knit = basis_knit
289
292
        self.factory = factory or KnitAnnotateFactory()
290
293
        self.writable = (access_mode == 'w')
291
294
        self.delta = delta
533
536
            cursor = version_id
534
537
 
535
538
            while cursor is not None and cursor not in component_data:
536
 
                picked_knit = self
537
 
                method = picked_knit._index.get_method(cursor)
 
539
                method = self._index.get_method(cursor)
538
540
                if method == 'fulltext':
539
541
                    next = None
540
542
                else:
541
 
                    next = picked_knit.get_parents(cursor)[0]
 
543
                    next = self.get_parents(cursor)[0]
542
544
                data_pos, data_size = self._index.get_position(cursor)
543
545
                component_data[cursor] = (method, data_pos, data_size, next)
544
546
                cursor = next
554
556
        if cached_version is not None:
555
557
            return cached_version
556
558
 
557
 
        if self.basis_knit and version_id in self.basis_knit:
558
 
            return self.basis_knit._get_content(version_id)
559
 
        
560
559
        text_map, contents_map = self._get_content_maps([version_id])
561
560
        return contents_map[version_id]
562
561