##// END OF EJS Templates
obsolete: don't use os.stat in repo.obsstore.__nonzero__ if it's static HTTP...
av6 -
r49640:ef50a62e default
parent child Browse files
Show More
@@ -575,11 +575,17 b' class obsstore(object):'
575 return len(self._all)
575 return len(self._all)
576
576
577 def __nonzero__(self):
577 def __nonzero__(self):
578 from . import statichttprepo
579
580 if isinstance(self.repo, statichttprepo.statichttprepository):
581 # If repo is accessed via static HTTP, then we can't use os.stat()
582 # to just peek at the file size.
583 return len(self._data) > 1
578 if not self._cached('_all'):
584 if not self._cached('_all'):
579 try:
585 try:
580 return self.svfs.stat(b'obsstore').st_size > 1
586 return self.svfs.stat(b'obsstore').st_size > 1
581 except OSError as inst:
587 except OSError as inst:
582 if inst.errno not in (errno.ENOENT, errno.EINVAL):
588 if inst.errno != errno.ENOENT:
583 raise
589 raise
584 # just build an empty _all list if no obsstore exists, which
590 # just build an empty _all list if no obsstore exists, which
585 # avoids further stat() syscalls
591 # avoids further stat() syscalls
General Comments 0
You need to be logged in to leave comments. Login now