# HG changeset patch # User Anton Shestakov # Date 1643386072 -10800 # Node ID 4507bc00136506dc3a9b64b37ac40a1e68f582a3 # Parent 21ac6aedd5e551fa0b6e9b52f90fbf6d1f09e5c2 obsolete: make sure windows tests pass when stat() is given a URL This is a temporary fix for an issue that's only visible on windows, but exists on other platforms as well. The issue is if we're trying to use obsstore from a remote peer and that peer is a static HTTP repo, vfs tries to os.stat() a remote file using a URL to that file (e.g. http://localhost/repo/.hg/store/obsstore). The next patch in this series makes branchcache obsolescence-aware, so in certain situations exchange process will try os.stat()ing a URL. On windows this will produce an OSError that is not ENOENT, but EINVAL instead (because of `:` symbol, for example). Differential Revision: https://phab.mercurial-scm.org/D12100 diff -r 21ac6aedd5e5 -r 4507bc001365 mercurial/obsolete.py --- a/mercurial/obsolete.py Mon Jan 31 18:38:15 2022 +0100 +++ b/mercurial/obsolete.py Fri Jan 28 19:07:52 2022 +0300 @@ -583,7 +583,7 @@ try: return self.svfs.stat(b'obsstore').st_size > 1 except OSError as inst: - if inst.errno != errno.ENOENT: + if inst.errno not in (errno.ENOENT, errno.EINVAL): raise # just build an empty _all list if no obsstore exists, which # avoids further stat() syscalls