# HG changeset patch # User Mads Kiilerich # Date 2013-04-14 23:41:49 # Node ID 5f9019e6d451aed829bbae55f56ed317aa5c9e17 # Parent 3de9b1f9ebc3e95db2d77079bb1f33b15cdda311 largefiles: don't store whole file in memory for 'cat' diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -542,7 +542,8 @@ def catlfile(repo, lfile, rev, filename) 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