~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

Create a registry of versioned file record adapters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
class KnitAdapter(object):
146
146
    """Base class for knit record adaption."""
147
147
 
148
 
    def __init__(self):
 
148
    def __init__(self, basis_vf):
 
149
        """Create an adapter which accesses full texts from basis_vf.
 
150
        
 
151
        :param basis_vf: A versioned file to access basis texts of deltas from.
 
152
            May be None for adapters that do not need to access basis texts.
 
153
        """
149
154
        self._data = _KnitData(None)
150
155
        self._annotate_factory = KnitAnnotateFactory()
151
156
        self._plain_factory = KnitPlainFactory()
 
157
        self._basis_vf = basis_vf
152
158
 
153
159
 
154
160
class FTAnnotatedToUnannotated(KnitAdapter):
189
195
class DeltaAnnotatedToFullText(KnitAdapter):
190
196
    """An adapter for deltas from annotated to unannotated."""
191
197
 
192
 
    def __init__(self, basis_vf):
193
 
        """Create an adapter which accesses full texts from basis_vf.
194
 
        
195
 
        :param basis_vf: A versioned file to access basis texts of deltas from.
196
 
        """
197
 
        KnitAdapter.__init__(self)
198
 
        self._basis_vf = basis_vf
199
 
 
200
198
    def get_bytes(self, factory, annotated_compressed_bytes):
201
199
        rec, contents = \
202
200
            self._data._parse_record_unchecked(annotated_compressed_bytes)
226
224
class DeltaPlainToFullText(KnitAdapter):
227
225
    """An adapter for deltas from annotated to unannotated."""
228
226
 
229
 
    def __init__(self, basis_vf):
230
 
        """Create an adapter which accesses full texts from basis_vf.
231
 
        
232
 
        :param basis_vf: A versioned file to access basis texts of deltas from.
233
 
        """
234
 
        KnitAdapter.__init__(self)
235
 
        self._basis_vf = basis_vf
236
 
 
237
227
    def get_bytes(self, factory, compressed_bytes):
238
228
        rec, contents = \
239
229
            self._data._parse_record_unchecked(compressed_bytes)