Mercurial > public > mercurial-scm > hg-stable
changeset 52936:c92f9edd362a
util: expose the default chunk size for filechunkiter
This will help us to decide when to use it or not in the next changeset.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 05 Feb 2025 21:58:05 +0100 |
parents | f1ac5117459b |
children | 119cddd02b8c |
files | mercurial/util.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Mon Feb 03 23:28:09 2025 +0100 +++ b/mercurial/util.py Wed Feb 05 21:58:05 2025 +0100 @@ -2881,7 +2881,10 @@ return d -def filechunkiter(f, size=131072, limit=None): +DEFAULT_FILE_CHUNK = 128 * (2**10) + + +def filechunkiter(f, size=DEFAULT_FILE_CHUNK, limit=None): """Create a generator that produces the data in the file size (default 131072) bytes at a time, up to optional limit (default is to read all data). Chunks may be less than size bytes if the