comparison mercurial/vfs.py @ 49574:2506c3ac73f4

vfs: make the default opener mode binary The default was already binary for `abstractvfs`, and the `vfs` implementation adds binary mode if the caller didn't supply it. Therefore, it should be safe for all vfs objects (and I don't think we want text reads anyway).
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 04 Nov 2022 17:54:43 -0400
parents cc9a60050a07
children b7cf91ef03ba
comparison
equal deleted inserted replaced
49573:cc9a60050a07 49574:2506c3ac73f4
423 self.audit(path, mode=mode) 423 self.audit(path, mode=mode)
424 424
425 def __call__( 425 def __call__(
426 self, 426 self,
427 path: bytes, 427 path: bytes,
428 mode: bytes = b"r", 428 mode: bytes = b"rb",
429 atomictemp=False, 429 atomictemp=False,
430 notindexed=False, 430 notindexed=False,
431 backgroundclose=False, 431 backgroundclose=False,
432 checkambig=False, 432 checkambig=False,
433 auditpath=True, 433 auditpath=True,
610 '''Wrapper vfs preventing any writing.''' 610 '''Wrapper vfs preventing any writing.'''
611 611
612 def __init__(self, vfs: "vfs"): 612 def __init__(self, vfs: "vfs"):
613 proxyvfs.__init__(self, vfs) 613 proxyvfs.__init__(self, vfs)
614 614
615 def __call__(self, path: bytes, mode: bytes = b'r', *args, **kw): 615 def __call__(self, path: bytes, mode: bytes = b'rb', *args, **kw):
616 if mode not in (b'r', b'rb'): 616 if mode not in (b'r', b'rb'):
617 raise error.Abort(_(b'this vfs is read only')) 617 raise error.Abort(_(b'this vfs is read only'))
618 return self.vfs(path, mode, *args, **kw) 618 return self.vfs(path, mode, *args, **kw)
619 619
620 def join(self, path: Optional[bytes], *insidef: bytes) -> bytes: 620 def join(self, path: Optional[bytes], *insidef: bytes) -> bytes: