Mercurial > hg
view doc/Makefile @ 44248:12491abf93bd stable
worker: manually buffer reads from pickle stream
My previous fix (D8051, cb52e619c99e, which added Python's built-in buffering
to the pickle stream) has the problem that the selector will ignore the buffer.
When multiple pickled objects are read from the pipe into the buffer at once,
only one object will be loaded.
This can repeat until the buffer is full and delays the processing of completed
items until the worker exits, at which point the pipe is always considered
readable and all remaining items are processed.
This changeset reverts D8051, removing the buffer again. Instead, on Python 3
only, we use a wrapper to modify the "read" provided to the Unpickler to behave
more like a buffered read. We never read more bytes from the pipe than the
Unpickler requests, so the selector behaves as expected.
Also add a test case for "pickle data was truncated" issue.
https://phab.mercurial-scm.org/D8051#119193
Differential Revision: https://phab.mercurial-scm.org/D8076
author | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> |
---|---|
date | Tue, 04 Feb 2020 22:07:36 +0100 |
parents | 640bae94f2f3 |
children | eb9026a84e83 |
line wrap: on
line source
SOURCES=$(notdir $(wildcard ../mercurial/helptext/*.[0-9].txt)) MAN=$(SOURCES:%.txt=%) HTML=$(SOURCES:%.txt=%.html) GENDOC=gendoc.py ../mercurial/commands.py ../mercurial/help.py \ ../mercurial/helptext/*.txt ../hgext/*.py ../hgext/*/__init__.py PREFIX=/usr/local MANDIR=$(PREFIX)/share/man INSTALL=install -c -m 644 PYTHON?=python RSTARGS= export HGENCODING=UTF-8 all: man html man: $(MAN) html: $(HTML) # This logic is duplicated in setup.py:hgbuilddoc() common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt): $(GENDOC) ${PYTHON} gendoc.py "$(basename $@)" > $@.tmp mv $@.tmp $@ %: %.txt %.gendoc.txt common.txt $(PYTHON) runrst hgmanpage $(RSTARGS) --halt warning \ --strip-elements-with-class htmlonly $*.txt $* %.html: %.txt %.gendoc.txt common.txt $(PYTHON) runrst html $(RSTARGS) --halt warning \ --link-stylesheet --stylesheet-path style.css $*.txt $*.html MANIFEST: man html # tracked files are already in the main MANIFEST $(RM) $@ for i in $(MAN) $(HTML); do \ echo "doc/$$i" >> $@ ; \ done install: man for i in $(MAN) ; do \ subdir=`echo $$i | sed -n 's/^.*\.\([0-9]\)$$/man\1/p'` ; \ mkdir -p "$(DESTDIR)$(MANDIR)"/$$subdir ; \ $(INSTALL) $$i "$(DESTDIR)$(MANDIR)"/$$subdir ; \ done clean: $(RM) $(MAN) $(HTML) common.txt $(SOURCES) $(SOURCES:%.txt=%.gendoc.txt) MANIFEST