hgext3rd/__init__.py
author |
Gregory Szorc <gregory.szorc@gmail.com> |
|
Sun, 20 Nov 2016 13:50:45 -0800 |
changeset 30475 |
2add671bf55b |
parent 28541 |
4b81487a01d4
|
child 43076 |
2372284d9457 |
permissions |
-rw-r--r-- |
wireproto: perform chunking and compression at protocol layer (API)
Currently, the "streamres" response type is populated with a generator
of chunks with compression possibly already applied. This puts the onus
on commands to perform chunking and compression. Architecturally, I
think this is the wrong place to perform this work. I think commands
should say "here is the data" and the protocol layer should take care
of encoding the final bytes to put on the wire.
Additionally, upcoming commits will improve wire protocol support for
compression. Having a central place for performing compression in the
protocol transport layer will be easier than having to deal with
compression at the commands layer.
This commit refactors the "streamres" response type to accept either
a generator or an object with "read." Additionally, the type now
accepts a flag indicating whether the response is a "version 1
compressible" response. This basically identifies all commands
currently performing compression. I could have used a special type
for this, but a flag works just as well. The argument name
foreshadows the introduction of wire protocol changes, hence the "v1."
The code for chunking and compressing has been moved to the output
generation function for each protocol transport. Some code has been
inlined, resulting in the deletion of now unused methods.
28541
4b81487a01d4
extensions: also search for extension in the 'hgext3rd' package
Pierre-Yves David <pierre-yves.david@fb.com>
diff
changeset
|
1 |
# name space package to host third party extensions
|
28450
155e3308289c
hgext: officially turn 'hgext' into a namespace package
Pierre-Yves David <pierre-yves.david@fb.com>
diff
changeset
|
2 |
from __future__ import absolute_import
|
155e3308289c
hgext: officially turn 'hgext' into a namespace package
Pierre-Yves David <pierre-yves.david@fb.com>
diff
changeset
|
3 |
import pkgutil
|
155e3308289c
hgext: officially turn 'hgext' into a namespace package
Pierre-Yves David <pierre-yves.david@fb.com>
diff
changeset
|
4 |
__path__ = pkgutil.extend_path(__path__, __name__)
|