Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 52924: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 | e4552f135e35 |
children |
comparison
equal
deleted
inserted
replaced
52923:f1ac5117459b | 52924:c92f9edd362a |
---|---|
2879 d = b''.join(buf) | 2879 d = b''.join(buf) |
2880 self._absolute_offset += len(d) | 2880 self._absolute_offset += len(d) |
2881 return d | 2881 return d |
2882 | 2882 |
2883 | 2883 |
2884 def filechunkiter(f, size=131072, limit=None): | 2884 DEFAULT_FILE_CHUNK = 128 * (2**10) |
2885 | |
2886 | |
2887 def filechunkiter(f, size=DEFAULT_FILE_CHUNK, limit=None): | |
2885 """Create a generator that produces the data in the file size | 2888 """Create a generator that produces the data in the file size |
2886 (default 131072) bytes at a time, up to optional limit (default is | 2889 (default 131072) bytes at a time, up to optional limit (default is |
2887 to read all data). Chunks may be less than size bytes if the | 2890 to read all data). Chunks may be less than size bytes if the |
2888 chunk is the last chunk in the file, or the file is a socket or | 2891 chunk is the last chunk in the file, or the file is a socket or |
2889 some other type of file that sometimes reads less data than is | 2892 some other type of file that sometimes reads less data than is |