[Updated] D12195: obsolete: don't use os.stat in repo.obsstore.__nonzero__ if it's static HTTP
av6 (Anton Shestakov)
phabricator at mercurial-scm.org
Wed Feb 16 11:28:13 UTC 2022
av6 updated this revision to Diff 32253.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12195?vs=32236&id=32253
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12195/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12195
AFFECTED FILES
mercurial/obsolete.py
CHANGE DETAILS
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -575,11 +575,16 @@
return len(self._all)
def __nonzero__(self):
+ from . import statichttprepo
+ if isinstance(self.repo, statichttprepo.statichttprepository):
+ # If repo is accessed via static HTTP, then we can't use os.stat()
+ # to just peek at the file size.
+ return len(self._data) > 1
if not self._cached('_all'):
try:
return self.svfs.stat(b'obsstore').st_size > 1
except OSError as inst:
- if inst.errno not in (errno.ENOENT, errno.EINVAL):
+ if inst.errno != errno.ENOENT:
raise
# just build an empty _all list if no obsstore exists, which
# avoids further stat() syscalls
To: av6, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220216/7b4dd587/attachment-0002.html>
More information about the Mercurial-patches
mailing list