Show More
@@ -470,8 +470,10 b' class revbranchcache(object):' | |||
|
470 | 470 | def write(self, tr=None): |
|
471 | 471 | """Save branch cache if it is dirty.""" |
|
472 | 472 | repo = self._repo |
|
473 | if True: | |
|
473 | wlock = None | |
|
474 | try: | |
|
474 | 475 | if self._rbcnamescount < len(self._names): |
|
476 | wlock = repo.wlock(wait=False) | |
|
475 | 477 | try: |
|
476 | 478 | if self._rbcnamescount != 0: |
|
477 | 479 | f = repo.vfs.open(_rbcnames, 'ab') |
@@ -501,6 +503,8 b' class revbranchcache(object):' | |||
|
501 | 503 | |
|
502 | 504 | start = self._rbcrevslen * _rbcrecsize |
|
503 | 505 | if start != len(self._rbcrevs): |
|
506 | if wlock is None: | |
|
507 | wlock = repo.wlock(wait=False) | |
|
504 | 508 | revs = min(len(repo.changelog), |
|
505 | 509 | len(self._rbcrevs) // _rbcrecsize) |
|
506 | 510 | try: |
@@ -521,3 +525,8 b' class revbranchcache(object):' | |||
|
521 | 525 | inst) |
|
522 | 526 | return |
|
523 | 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 | 554 | $ rmdir .hg/cache/rbc-revs-v1 |
|
555 | 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 | 569 | recovery from invalid cache revs file with trailing data |
|
558 | 570 | $ echo >> .hg/cache/rbc-revs-v1 |
|
559 | 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