~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-14 16:05:43 UTC
  • mto: (3735.2.156 brisbane-core)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090314160543-04i9wg8s13bjh337
A bit of reworking changes things so content is expanded at extract() time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
            self._content = zlib.decompress(self._z_content)
202
202
        self._z_content = None
203
203
 
 
204
    def _ensure_content(self):
 
205
        """Make sure that content has been expanded."""
 
206
        if self._content is None:
 
207
            self._expand_content()
 
208
 
204
209
    def _parse_bytes(self, bytes):
205
210
        """Read the various lengths from the header.
206
211
 
248
253
        out._parse_bytes(bytes)
249
254
        if not _NO_LABELS:
250
255
            out._parse_header()
251
 
        out._expand_content()
 
256
        # out._expand_content()
252
257
        return out
253
258
 
254
259
    def extract(self, key, index_memo, sha1=None):
258
263
        :param sha1: TODO (should we validate only when sha1 is supplied?)
259
264
        :return: The bytes for the content
260
265
        """
 
266
        self._ensure_content()
261
267
        if _NO_LABELS or not self._entries:
262
268
            start, end = index_memo[3:5]
263
269
            # The bytes are 'f' or 'd' for the type, then a variable-length