changeset 18973:5f9019e6d451

largefiles: don't store whole file in memory for 'cat'
author Mads Kiilerich <madski@unity3d.com>
date Mon, 15 Apr 2013 01:41:49 +0200
parents 3de9b1f9ebc3
children d78a136a8036
files hgext/largefiles/lfcommands.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Tue Apr 16 13:55:38 2013 +0200
+++ b/hgext/largefiles/lfcommands.py	Mon Apr 15 01:41:49 2013 +0200
@@ -542,7 +542,8 @@
     path = lfutil.usercachepath(repo.ui, hash)
     fpout = cmdutil.makefileobj(repo, filename)
     fpin = open(path, "rb")
-    fpout.write(fpin.read())
+    for chunk in lfutil.blockstream(fpin):
+        fpout.write(chunk)
     fpout.close()
     fpin.close()
     return 0