largefiles: don't store whole file in memory for 'cat'
authorMads Kiilerich <madski@unity3d.com>
Mon, 15 Apr 2013 01:41:49 +0200
changeset 18973 5f9019e6d451
parent 18972 3de9b1f9ebc3
child 18974 d78a136a8036
largefiles: don't store whole file in memory for 'cat'
hgext/largefiles/lfcommands.py
--- 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