Show More
@@ -470,8 +470,10 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 | wlock = None | |
|
474 | try: | |||
474 | if self._rbcnamescount < len(self._names): |
|
475 | if self._rbcnamescount < len(self._names): | |
|
476 | wlock = repo.wlock(wait=False) | |||
475 | try: |
|
477 | try: | |
476 | if self._rbcnamescount != 0: |
|
478 | if self._rbcnamescount != 0: | |
477 | f = repo.vfs.open(_rbcnames, 'ab') |
|
479 | f = repo.vfs.open(_rbcnames, 'ab') | |
@@ -501,6 +503,8 b' class revbranchcache(object):' | |||||
501 |
|
503 | |||
502 | start = self._rbcrevslen * _rbcrecsize |
|
504 | start = self._rbcrevslen * _rbcrecsize | |
503 | if start != len(self._rbcrevs): |
|
505 | if start != len(self._rbcrevs): | |
|
506 | if wlock is None: | |||
|
507 | wlock = repo.wlock(wait=False) | |||
504 | revs = min(len(repo.changelog), |
|
508 | revs = min(len(repo.changelog), | |
505 | len(self._rbcrevs) // _rbcrecsize) |
|
509 | len(self._rbcrevs) // _rbcrecsize) | |
506 | try: |
|
510 | try: | |
@@ -521,3 +525,8 b' class revbranchcache(object):' | |||||
521 | inst) |
|
525 | inst) | |
522 | return |
|
526 | return | |
523 | self._rbcrevslen = revs |
|
527 | self._rbcrevslen = revs | |
|
528 | except error.LockError as inst: | |||
|
529 | repo.ui.debug("couldn't write revision branch cache: %s\n" % inst) | |||
|
530 | finally: | |||
|
531 | if wlock is not None: | |||
|
532 | wlock.release() |
@@ -554,6 +554,18 b' no errors when revbranchcache is not wri' | |||||
554 | $ rmdir .hg/cache/rbc-revs-v1 |
|
554 | $ rmdir .hg/cache/rbc-revs-v1 | |
555 | $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1 |
|
555 | $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1 | |
556 |
|
556 | |||
|
557 | no errors when wlock cannot be acquired | |||
|
558 | ||||
|
559 | #if unix-permissions | |||
|
560 | $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_ | |||
|
561 | $ rm -f .hg/cache/branch* | |||
|
562 | $ chmod 555 .hg | |||
|
563 | $ hg head a -T '{rev}\n' | |||
|
564 | 5 | |||
|
565 | $ chmod 755 .hg | |||
|
566 | $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1 | |||
|
567 | #endif | |||
|
568 | ||||
557 | recovery from invalid cache revs file with trailing data |
|
569 | recovery from invalid cache revs file with trailing data | |
558 | $ echo >> .hg/cache/rbc-revs-v1 |
|
570 | $ echo >> .hg/cache/rbc-revs-v1 | |
559 | $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug |
|
571 | $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug |
General Comments 0
You need to be logged in to leave comments.
Login now