hgext/remotefilelog/shallowutil.py
changeset 52571 94fa2543d710
parent 52383 51df2bf7c40b
child 52640 24ee91ba9aa8
--- a/hgext/remotefilelog/shallowutil.py	Mon Dec 16 21:16:30 2024 -0500
+++ b/hgext/remotefilelog/shallowutil.py	Mon Dec 16 21:18:17 2024 -0500
@@ -321,18 +321,14 @@
 
 
 def readfile(path):
-    f = open(path, 'rb')
-    try:
-        result = f.read()
+    result = util.readfile(path)
 
-        # we should never have empty files
-        if not result:
-            os.remove(path)
-            raise IOError(b"empty file: %s" % path)
+    # we should never have empty files
+    if not result:
+        os.remove(path)
+        raise IOError(b"empty file: %s" % path)
 
-        return result
-    finally:
-        f.close()
+    return result
 
 
 def unlinkfile(filepath):