Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/lfutil.py @ 52421:aa3261b40492
largefiles: stop using the `pycompat.open()` shim
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 05 Dec 2024 13:08:04 -0500 |
parents | f4733654f144 |
children | 24ee91ba9aa8 |
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py Thu Dec 05 13:00:59 2024 -0500 +++ b/hgext/largefiles/lfutil.py Thu Dec 05 13:08:04 2024 -0500 @@ -17,7 +17,6 @@ from mercurial.i18n import _ from mercurial.node import hex -from mercurial.pycompat import open from mercurial import ( dirstate, @@ -75,7 +74,7 @@ util.oslink(src, dest) except OSError: # if hardlinks fail, fallback on atomic copy - with open(src, b'rb') as srcf, util.atomictempfile(dest) as dstf: + with open(src, 'rb') as srcf, util.atomictempfile(dest) as dstf: for chunk in util.filechunkiter(srcf): dstf.write(chunk) os.chmod(dest, os.stat(src).st_mode) @@ -328,7 +327,7 @@ wvfs.makedirs(wvfs.dirname(wvfs.join(filename))) # The write may fail before the file is fully written, but we # don't use atomic writes in the working copy. - with open(path, b'rb') as srcfd, wvfs(filename, b'wb') as destfd: + with open(path, 'rb') as srcfd, wvfs(filename, b'wb') as destfd: gothash = copyandhash(util.filechunkiter(srcfd), destfd) if gothash != hash: repo.ui.warn( @@ -369,7 +368,7 @@ link(usercachepath(repo.ui, hash), storepath(repo, hash)) else: util.makedirs(os.path.dirname(storepath(repo, hash))) - with open(file, b'rb') as srcf: + with open(file, 'rb') as srcf: with util.atomictempfile( storepath(repo, hash), createmode=repo.store.createmode ) as dstf: @@ -489,7 +488,7 @@ def hashfile(file): if not os.path.exists(file): return b'' - with open(file, b'rb') as fd: + with open(file, 'rb') as fd: return hexsha1(fd)