Show More
@@ -470,6 +470,7 b' class revbranchcache(object):' | |||||
470 | def write(self, tr=None): |
|
470 | def write(self, tr=None): | |
471 | """Save branch cache if it is dirty.""" |
|
471 | """Save branch cache if it is dirty.""" | |
472 | repo = self._repo |
|
472 | repo = self._repo | |
|
473 | if True: | |||
473 | if self._rbcnamescount < len(self._names): |
|
474 | if self._rbcnamescount < len(self._names): | |
474 | try: |
|
475 | try: | |
475 | if self._rbcnamescount != 0: |
|
476 | if self._rbcnamescount != 0: | |
@@ -478,15 +479,18 b' class revbranchcache(object):' | |||||
478 | f.write('\0') |
|
479 | f.write('\0') | |
479 | else: |
|
480 | else: | |
480 | f.close() |
|
481 | f.close() | |
481 |
repo.ui.debug("%s changed - rewriting it\n" |
|
482 | repo.ui.debug("%s changed - rewriting it\n" | |
|
483 | % _rbcnames) | |||
482 | self._rbcnamescount = 0 |
|
484 | self._rbcnamescount = 0 | |
483 | self._rbcrevslen = 0 |
|
485 | self._rbcrevslen = 0 | |
484 | if self._rbcnamescount == 0: |
|
486 | if self._rbcnamescount == 0: | |
485 |
# before rewriting names, make sure references are |
|
487 | # before rewriting names, make sure references are | |
|
488 | # removed | |||
486 | repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True) |
|
489 | repo.vfs.unlinkpath(_rbcrevs, ignoremissing=True) | |
487 | f = repo.vfs.open(_rbcnames, 'wb') |
|
490 | f = repo.vfs.open(_rbcnames, 'wb') | |
488 | f.write('\0'.join(encoding.fromlocal(b) |
|
491 | f.write('\0'.join(encoding.fromlocal(b) | |
489 |
for b in self._names[self._rbcnamescount:] |
|
492 | for b in self._names[self._rbcnamescount:] | |
|
493 | )) | |||
490 | self._rbcsnameslen = f.tell() |
|
494 | self._rbcsnameslen = f.tell() | |
491 | f.close() |
|
495 | f.close() | |
492 | except (IOError, OSError, error.Abort) as inst: |
|
496 | except (IOError, OSError, error.Abort) as inst: | |
@@ -497,11 +501,13 b' class revbranchcache(object):' | |||||
497 |
|
501 | |||
498 | start = self._rbcrevslen * _rbcrecsize |
|
502 | start = self._rbcrevslen * _rbcrecsize | |
499 | if start != len(self._rbcrevs): |
|
503 | if start != len(self._rbcrevs): | |
500 |
revs = min(len(repo.changelog), |
|
504 | revs = min(len(repo.changelog), | |
|
505 | len(self._rbcrevs) // _rbcrecsize) | |||
501 | try: |
|
506 | try: | |
502 | f = repo.vfs.open(_rbcrevs, 'ab') |
|
507 | f = repo.vfs.open(_rbcrevs, 'ab') | |
503 | if f.tell() != start: |
|
508 | if f.tell() != start: | |
504 |
repo.ui.debug("truncating %s to %s\n" |
|
509 | repo.ui.debug("truncating %s to %s\n" | |
|
510 | % (_rbcrevs, start)) | |||
505 | f.seek(start) |
|
511 | f.seek(start) | |
506 | if f.tell() != start: |
|
512 | if f.tell() != start: | |
507 | start = 0 |
|
513 | start = 0 |
General Comments 0
You need to be logged in to leave comments.
Login now