##// END OF EJS Templates
revlog: add a fast method for getting a list of chunks...
Siddharth Agarwal -
r19713:c2e27e57 default
parent child Browse files
Show More
@@ -853,6 +853,28 b' class revlog(object):'
853 def _chunk(self, rev):
853 def _chunk(self, rev):
854 return decompress(self._chunkraw(rev, rev))
854 return decompress(self._chunkraw(rev, rev))
855
855
856 def _chunks(self, revs):
857 '''faster version of [self._chunk(rev) for rev in revs]
858
859 Assumes that revs is in ascending order.'''
860 start = self.start
861 length = self.length
862 inline = self._inline
863 iosize = self._io.size
864 getchunk = self._getchunk
865
866 l = []
867 ladd = l.append
868
869 for rev in revs:
870 chunkstart = start(rev)
871 if inline:
872 chunkstart += (rev + 1) * iosize
873 chunklength = length(rev)
874 ladd(decompress(getchunk(chunkstart, chunklength)))
875
876 return l
877
856 def _chunkbase(self, rev):
878 def _chunkbase(self, rev):
857 return self._chunk(rev)
879 return self._chunk(rev)
858
880
@@ -933,7 +955,7 b' class revlog(object):'
933 if text is None:
955 if text is None:
934 text = str(self._chunkbase(base))
956 text = str(self._chunkbase(base))
935
957
936 bins = [self._chunk(r) for r in chain]
958 bins = self._chunks(chain)
937 text = mdiff.patches(text, bins)
959 text = mdiff.patches(text, bins)
938
960
939 text = self._checkhash(text, node, rev)
961 text = self._checkhash(text, node, rev)
General Comments 0
You need to be logged in to leave comments. Login now