Show More
@@ -471,10 +471,12 b' class revbranchcache(object):' | |||||
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 | wlock = None |
|
473 | wlock = None | |
|
474 | step = '' | |||
474 | try: |
|
475 | try: | |
475 | if self._rbcnamescount < len(self._names): |
|
476 | if self._rbcnamescount < len(self._names): | |
|
477 | step = ' names' | |||
476 | wlock = repo.wlock(wait=False) |
|
478 | wlock = repo.wlock(wait=False) | |
477 |
|
|
479 | if True: | |
478 | if self._rbcnamescount != 0: |
|
480 | if self._rbcnamescount != 0: | |
479 | f = repo.vfs.open(_rbcnames, 'ab') |
|
481 | f = repo.vfs.open(_rbcnames, 'ab') | |
480 | if f.tell() == self._rbcsnameslen: |
|
482 | if f.tell() == self._rbcsnameslen: | |
@@ -495,19 +497,16 b' class revbranchcache(object):' | |||||
495 | )) |
|
497 | )) | |
496 | self._rbcsnameslen = f.tell() |
|
498 | self._rbcsnameslen = f.tell() | |
497 | f.close() |
|
499 | f.close() | |
498 | except (IOError, OSError, error.Abort) as inst: |
|
|||
499 | repo.ui.debug("couldn't write revision branch cache names: " |
|
|||
500 | "%s\n" % inst) |
|
|||
501 | return |
|
|||
502 | self._rbcnamescount = len(self._names) |
|
500 | self._rbcnamescount = len(self._names) | |
503 |
|
501 | |||
504 | start = self._rbcrevslen * _rbcrecsize |
|
502 | start = self._rbcrevslen * _rbcrecsize | |
505 | if start != len(self._rbcrevs): |
|
503 | if start != len(self._rbcrevs): | |
|
504 | step = '' | |||
506 | if wlock is None: |
|
505 | if wlock is None: | |
507 | wlock = repo.wlock(wait=False) |
|
506 | wlock = repo.wlock(wait=False) | |
508 | revs = min(len(repo.changelog), |
|
507 | revs = min(len(repo.changelog), | |
509 | len(self._rbcrevs) // _rbcrecsize) |
|
508 | len(self._rbcrevs) // _rbcrecsize) | |
510 |
|
|
509 | if True: | |
511 | f = repo.vfs.open(_rbcrevs, 'ab') |
|
510 | f = repo.vfs.open(_rbcrevs, 'ab') | |
512 | if f.tell() != start: |
|
511 | if f.tell() != start: | |
513 | repo.ui.debug("truncating %s to %s\n" |
|
512 | repo.ui.debug("truncating %s to %s\n" | |
@@ -520,13 +519,10 b' class revbranchcache(object):' | |||||
520 | end = revs * _rbcrecsize |
|
519 | end = revs * _rbcrecsize | |
521 | f.write(self._rbcrevs[start:end]) |
|
520 | f.write(self._rbcrevs[start:end]) | |
522 | f.close() |
|
521 | f.close() | |
523 | except (IOError, OSError, error.Abort) as inst: |
|
|||
524 | repo.ui.debug("couldn't write revision branch cache: %s\n" % |
|
|||
525 | inst) |
|
|||
526 | return |
|
|||
527 | self._rbcrevslen = revs |
|
522 | self._rbcrevslen = revs | |
528 | except error.LockError as inst: |
|
523 | except (IOError, OSError, error.Abort, error.LockError) as inst: | |
529 |
repo.ui.debug("couldn't write revision branch cache: %s\n" |
|
524 | repo.ui.debug("couldn't write revision branch cache%s: %s\n" | |
|
525 | % (step, inst)) | |||
530 | finally: |
|
526 | finally: | |
531 | if wlock is not None: |
|
527 | if wlock is not None: | |
532 | wlock.release() |
|
528 | wlock.release() |
General Comments 0
You need to be logged in to leave comments.
Login now