Mercurial > hg-stable
changeset 49245:cdb85d0512b8
branching: fix wrong merge conflict resolution from 13dfad0f9f7a
13dfad0f9f7a merged stable into default, but accidentally added the
_blockingreader class from stable (but deindented) instead of merging the
changes from stable (2fe4efaa59af) into the existing _blockingreader class.
This resulted in the _blockingreader being there two times.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Wed, 25 May 2022 17:23:16 +0200 |
parents | 13e523228623 |
children | 58a814d062ca |
files | mercurial/worker.py |
diffstat | 1 files changed, 1 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/worker.py Thu May 19 00:51:36 2022 +0100 +++ b/mercurial/worker.py Wed May 25 17:23:16 2022 +0200 @@ -68,7 +68,7 @@ return threading.current_thread() == threading.main_thread() -class _blockingreader(object): +class _blockingreader: def __init__(self, wrapped): self._wrapped = wrapped @@ -114,37 +114,6 @@ return bytes(buf) -class _blockingreader: - def __init__(self, wrapped): - self._wrapped = wrapped - - # Do NOT implement readinto() by making it delegate to - # _wrapped.readinto(), since that is unbuffered. The unpickler is fine - # with just read() and readline(), so we don't need to implement it. - - def readline(self): - return self._wrapped.readline() - - # issue multiple reads until size is fulfilled - def read(self, size=-1): - if size < 0: - return self._wrapped.readall() - - buf = bytearray(size) - view = memoryview(buf) - pos = 0 - - while pos < size: - ret = self._wrapped.readinto(view[pos:]) - if not ret: - break - pos += ret - - del view - del buf[pos:] - return bytes(buf) - - if pycompat.isposix or pycompat.iswindows: _STARTUP_COST = 0.01 # The Windows worker is thread based. If tasks are CPU bound, threads