comparison hgext/lfs/blobstore.py @ 44294:234001d22ba6

lfs: use str for the open() mode when opening a blob for py3 The other fix for this was to leave the mode as bytes, and import `pycompat.open()` like a bunch of other modules do. But I think it's confusing to still use bytes at the python boundary, and obviously error prone. Grepping for ` open\(.+, ['"][a-z]+['"]\)` and ` open\(.+, b['"][a-z]+['"]\)` outside of `tests`, there are 51 and 87 uses respectively, so it's not like this is a rare direct usage. Differential Revision: https://phab.mercurial-scm.org/D8099
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 08 Feb 2020 23:39:55 -0500
parents 43eea17ae7b3
children 89a2afe31e82
comparison
equal deleted inserted replaced
44293:83b2b829c94e 44294:234001d22ba6
126 self.ui = repo.ui 126 self.ui = repo.ui
127 127
128 def open(self, oid): 128 def open(self, oid):
129 """Open a read-only file descriptor to the named blob, in either the 129 """Open a read-only file descriptor to the named blob, in either the
130 usercache or the local store.""" 130 usercache or the local store."""
131 return open(self.path(oid), b'rb') 131 return open(self.path(oid), 'rb')
132 132
133 def path(self, oid): 133 def path(self, oid):
134 """Build the path for the given blob ``oid``. 134 """Build the path for the given blob ``oid``.
135 135
136 If the blob exists locally, the path may point to either the usercache 136 If the blob exists locally, the path may point to either the usercache