##// END OF EJS Templates
revlog: avoid an expensive string copy...
Bryan O'Sullivan -
r16423:a150923b default
parent child Browse files
Show More
@@ -818,7 +818,7 b' class revlog(object):'
818 df.close()
818 df.close()
819 self._addchunk(offset, d)
819 self._addchunk(offset, d)
820 if readahead > length:
820 if readahead > length:
821 return d[:length]
821 return util.buffer(d, 0, length)
822 return d
822 return d
823
823
824 def _getchunk(self, offset, length):
824 def _getchunk(self, offset, length):
@@ -831,7 +831,7 b' class revlog(object):'
831 if cachestart >= 0 and cacheend <= l:
831 if cachestart >= 0 and cacheend <= l:
832 if cachestart == 0 and cacheend == l:
832 if cachestart == 0 and cacheend == l:
833 return d # avoid a copy
833 return d # avoid a copy
834 return d[cachestart:cacheend]
834 return util.buffer(d, cachestart, cacheend - cachestart)
835
835
836 return self._loadchunk(offset, length)
836 return self._loadchunk(offset, length)
837
837
@@ -864,7 +864,7 b' class revlog(object):'
864 def revdiff(self, rev1, rev2):
864 def revdiff(self, rev1, rev2):
865 """return or calculate a delta between two revisions"""
865 """return or calculate a delta between two revisions"""
866 if rev1 != nullrev and self.deltaparent(rev2) == rev1:
866 if rev1 != nullrev and self.deltaparent(rev2) == rev1:
867 return self._chunk(rev2)
867 return str(self._chunk(rev2))
868
868
869 return mdiff.textdiff(self.revision(self.node(rev1)),
869 return mdiff.textdiff(self.revision(self.node(rev1)),
870 self.revision(self.node(rev2)))
870 self.revision(self.node(rev2)))
@@ -921,7 +921,7 b' class revlog(object):'
921
921
922 self._chunkraw(base, rev)
922 self._chunkraw(base, rev)
923 if text is None:
923 if text is None:
924 text = self._chunkbase(base)
924 text = str(self._chunkbase(base))
925
925
926 bins = [self._chunk(r) for r in chain]
926 bins = [self._chunk(r) for r in chain]
927 text = mdiff.patches(text, bins)
927 text = mdiff.patches(text, bins)
General Comments 0
You need to be logged in to leave comments. Login now