[Pkg-bazaar-commits] ./bzr/unstable r209: Revfile: handle decompression

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:44:01 UTC 2009


------------------------------------------------------------
revno: 209
committer: mbp at sourcefrog.net
timestamp: Sat 2005-04-09 15:14:33 +1000
message:
  Revfile: handle decompression 
modified:
  bzrlib/revfile.py
-------------- next part --------------
=== modified file 'bzrlib/revfile.py'
--- a/bzrlib/revfile.py	2005-04-09 05:09:10 +0000
+++ b/bzrlib/revfile.py	2005-04-09 05:14:33 +0000
@@ -284,6 +284,11 @@
 
 
     def _get_raw(self, idx, idxrec):
+        flags = idxrec[I_FLAGS]
+        if flags & ~FL_GZIP:
+            raise RevfileError("unsupported index flags %#x on index %d"
+                               % (flags, idx))
+        
         l = idxrec[I_LEN]
         if l == 0:
             return ''
@@ -296,11 +301,13 @@
                                "getting text for record %d in %r"
                                % (len(data), l, idx, self.basename))
 
+        if flags & FL_GZIP:
+            data = zlib.decompress(data)
+
         return data
         
 
     def _get_full_text(self, idx, idxrec):
-        assert idxrec[I_FLAGS] == 0
         assert idxrec[I_BASE] == _NO_RECORD
 
         text = self._get_raw(idx, idxrec)
@@ -309,7 +316,6 @@
 
 
     def _get_patched(self, idx, idxrec):
-        assert idxrec[I_FLAGS] == 0
         base = idxrec[I_BASE]
         assert base >= 0
         assert base < idx    # no loops!



More information about the Pkg-bazaar-commits mailing list