Show More
@@ -476,27 +476,23 b' class revbranchcache(object):' | |||||
476 | if self._rbcnamescount < len(self._names): |
|
476 | if self._rbcnamescount < len(self._names): | |
477 | step = ' names' |
|
477 | step = ' names' | |
478 | wlock = repo.wlock(wait=False) |
|
478 | wlock = repo.wlock(wait=False) | |
479 |
if |
|
479 | if self._rbcnamescount != 0: | |
480 |
|
|
480 | f = repo.vfs.open(_rbcnames, 'ab') | |
481 |
|
|
481 | if f.tell() == self._rbcsnameslen: | |
482 |
|
|
482 | f.write('\0') | |
483 |
|
|
483 | else: | |
484 |
|
|
484 | f.close() | |
485 | f.close() |
|
485 | repo.ui.debug("%s changed - rewriting it\n" % _rbcnames) | |
486 | repo.ui.debug("%s changed - rewriting it\n" |
|
486 | self._rbcnamescount = 0 | |
487 | % _rbcnames) |
|
487 | self._rbcrevslen = 0 | |
488 |
|
|
488 | if self._rbcnamescount == 0: | |
489 | self._rbcrevslen = 0 |
|
489 | # before rewriting names, make sure references are removed | |
490 | if self._rbcnamescount == 0: |
|
490 | repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True) | |
491 | # before rewriting names, make sure references are |
|
491 | f = repo.vfs.open(_rbcnames, 'wb') | |
492 | # removed |
|
492 | f.write('\0'.join(encoding.fromlocal(b) | |
493 | repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True) |
|
493 | for b in self._names[self._rbcnamescount:])) | |
494 | f = repo.vfs.open(_rbcnames, 'wb') |
|
494 | self._rbcsnameslen = f.tell() | |
495 | f.write('\0'.join(encoding.fromlocal(b) |
|
495 | f.close() | |
496 | for b in self._names[self._rbcnamescount:] |
|
|||
497 | )) |
|
|||
498 | self._rbcsnameslen = f.tell() |
|
|||
499 | f.close() |
|
|||
500 | self._rbcnamescount = len(self._names) |
|
496 | self._rbcnamescount = len(self._names) | |
501 |
|
497 | |||
502 | start = self._rbcrevslen * _rbcrecsize |
|
498 | start = self._rbcrevslen * _rbcrecsize | |
@@ -506,19 +502,17 b' class revbranchcache(object):' | |||||
506 | wlock = repo.wlock(wait=False) |
|
502 | wlock = repo.wlock(wait=False) | |
507 | revs = min(len(repo.changelog), |
|
503 | revs = min(len(repo.changelog), | |
508 | len(self._rbcrevs) // _rbcrecsize) |
|
504 | len(self._rbcrevs) // _rbcrecsize) | |
509 | if True: |
|
505 | f = repo.vfs.open(_rbcrevs, 'ab') | |
510 | f = repo.vfs.open(_rbcrevs, 'ab') |
|
506 | if f.tell() != start: | |
|
507 | repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start)) | |||
|
508 | f.seek(start) | |||
511 | if f.tell() != start: |
|
509 | if f.tell() != start: | |
512 | repo.ui.debug("truncating %s to %s\n" |
|
510 | start = 0 | |
513 | % (_rbcrevs, start)) |
|
|||
514 | f.seek(start) |
|
511 | f.seek(start) | |
515 |
|
|
512 | f.truncate() | |
516 | start = 0 |
|
513 | end = revs * _rbcrecsize | |
517 |
|
|
514 | f.write(self._rbcrevs[start:end]) | |
518 |
|
|
515 | f.close() | |
519 | end = revs * _rbcrecsize |
|
|||
520 | f.write(self._rbcrevs[start:end]) |
|
|||
521 | f.close() |
|
|||
522 | self._rbcrevslen = revs |
|
516 | self._rbcrevslen = revs | |
523 | except (IOError, OSError, error.Abort, error.LockError) as inst: |
|
517 | except (IOError, OSError, error.Abort, error.LockError) as inst: | |
524 | repo.ui.debug("couldn't write revision branch cache%s: %s\n" |
|
518 | repo.ui.debug("couldn't write revision branch cache%s: %s\n" |
General Comments 0
You need to be logged in to leave comments.
Login now