429 return |
429 return |
430 self._rbcnamescount = len(self._names) |
430 self._rbcnamescount = len(self._names) |
431 |
431 |
432 start = self._rbcrevslen * _rbcrecsize |
432 start = self._rbcrevslen * _rbcrecsize |
433 if start != len(self._rbcrevs): |
433 if start != len(self._rbcrevs): |
434 self._rbcrevslen = min(len(repo.changelog), |
434 revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) |
435 len(self._rbcrevs) // _rbcrecsize) |
|
436 try: |
435 try: |
437 f = repo.vfs.open(_rbcrevs, 'ab') |
436 f = repo.vfs.open(_rbcrevs, 'ab') |
438 # The position after open(x, 'a') is implementation defined- |
437 # The position after open(x, 'a') is implementation defined- |
439 # see issue3543. SEEK_END was added in 2.5 |
438 # see issue3543. SEEK_END was added in 2.5 |
440 f.seek(0, 2) #os.SEEK_END |
439 f.seek(0, 2) #os.SEEK_END |
441 if f.tell() != start: |
440 if f.tell() != start: |
442 repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start)) |
441 repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start)) |
443 f.seek(start) |
442 f.seek(start) |
444 f.truncate() |
443 f.truncate() |
445 end = self._rbcrevslen * _rbcrecsize |
444 end = revs * _rbcrecsize |
446 f.write(self._rbcrevs[start:end]) |
445 f.write(self._rbcrevs[start:end]) |
447 f.close() |
446 f.close() |
448 except (IOError, OSError, util.Abort), inst: |
447 except (IOError, OSError, util.Abort), inst: |
449 repo.ui.debug("couldn't write revision branch cache: %s\n" % |
448 repo.ui.debug("couldn't write revision branch cache: %s\n" % |
450 inst) |
449 inst) |
451 return |
450 return |
|
451 self._rbcrevslen = revs |