equal
deleted
inserted
replaced
334 |
334 |
335 def _writerevs(self, repo, start): |
335 def _writerevs(self, repo, start): |
336 """write the new revs to revbranchcache""" |
336 """write the new revs to revbranchcache""" |
337 revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) |
337 revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) |
338 with repo.cachevfs.open(_rbcrevs, b'ab') as f: |
338 with repo.cachevfs.open(_rbcrevs, b'ab') as f: |
339 if f.tell() != start: |
339 current_size = f.tell() |
340 repo.ui.debug( |
340 if current_size < start: |
341 b"truncating cache/%s to %d\n" % (_rbcrevs, start) |
341 start = 0 |
342 ) |
342 if current_size != start: |
|
343 msg = b"truncating cache/%s to %d\n" |
|
344 msg %= (_rbcrevs, start) |
|
345 repo.ui.debug(msg) |
343 f.seek(start) |
346 f.seek(start) |
344 if f.tell() != start: |
|
345 start = 0 |
|
346 f.seek(start) |
|
347 f.truncate() |
347 f.truncate() |
348 end = revs * _rbcrecsize |
348 end = revs * _rbcrecsize |
349 f.write(self._rbcrevs.slice(start, end)) |
349 f.write(self._rbcrevs.slice(start, end)) |
350 self._rbcrevslen = revs |
350 self._rbcrevslen = revs |