Show More
@@ -175,10 +175,7 b' def call(repo, req, cmd):' | |||
|
175 | 175 | req.respond(HTTP_OK, HGTYPE, body=rsp) |
|
176 | 176 | return [] |
|
177 | 177 | elif isinstance(rsp, wireproto.streamres): |
|
178 |
|
|
|
179 | gen = iter(lambda: rsp.reader.read(32768), '') | |
|
180 | else: | |
|
181 | gen = rsp.gen | |
|
178 | gen = rsp.gen | |
|
182 | 179 | |
|
183 | 180 | # This code for compression should not be streamres specific. It |
|
184 | 181 | # is here because we only compress streamres at the moment. |
@@ -76,13 +76,7 b' class sshserver(wireproto.abstractserver' | |||
|
76 | 76 | |
|
77 | 77 | def sendstream(self, source): |
|
78 | 78 | write = self.fout.write |
|
79 | ||
|
80 | if source.reader: | |
|
81 | gen = iter(lambda: source.reader.read(4096), '') | |
|
82 | else: | |
|
83 | gen = source.gen | |
|
84 | ||
|
85 | for chunk in gen: | |
|
79 | for chunk in source.gen: | |
|
86 | 80 | write(chunk) |
|
87 | 81 | self.fout.flush() |
|
88 | 82 |
@@ -520,7 +520,7 b' class streamres(object):' | |||
|
520 | 520 | |
|
521 | 521 | The call was successful and the result is a stream. |
|
522 | 522 | |
|
523 | Accepts either a generator or an object with a ``read(size)`` method. | |
|
523 | Accepts a generator containing chunks of data to be sent to the client. | |
|
524 | 524 | |
|
525 | 525 | ``v1compressible`` indicates whether this data can be compressed to |
|
526 | 526 | "version 1" clients (technically: HTTP peers using |
@@ -528,9 +528,8 b' class streamres(object):' | |||
|
528 | 528 | new commands because new clients should support a more modern compression |
|
529 | 529 | mechanism. |
|
530 | 530 | """ |
|
531 |
def __init__(self, gen=None, |
|
|
531 | def __init__(self, gen=None, v1compressible=False): | |
|
532 | 532 | self.gen = gen |
|
533 | self.reader = reader | |
|
534 | 533 | self.v1compressible = v1compressible |
|
535 | 534 | |
|
536 | 535 | class pushres(object): |
@@ -802,7 +801,8 b' def changegroup(repo, proto, roots):' | |||
|
802 | 801 | outgoing = discovery.outgoing(repo, missingroots=nodes, |
|
803 | 802 | missingheads=repo.heads()) |
|
804 | 803 | cg = changegroupmod.makechangegroup(repo, outgoing, '01', 'serve') |
|
805 | return streamres(reader=cg, v1compressible=True) | |
|
804 | gen = iter(lambda: cg.read(32768), '') | |
|
805 | return streamres(gen=gen, v1compressible=True) | |
|
806 | 806 | |
|
807 | 807 | @wireprotocommand('changegroupsubset', 'bases heads') |
|
808 | 808 | def changegroupsubset(repo, proto, bases, heads): |
@@ -811,7 +811,8 b' def changegroupsubset(repo, proto, bases' | |||
|
811 | 811 | outgoing = discovery.outgoing(repo, missingroots=bases, |
|
812 | 812 | missingheads=heads) |
|
813 | 813 | cg = changegroupmod.makechangegroup(repo, outgoing, '01', 'serve') |
|
814 | return streamres(reader=cg, v1compressible=True) | |
|
814 | gen = iter(lambda: cg.read(32768), '') | |
|
815 | return streamres(gen=gen, v1compressible=True) | |
|
815 | 816 | |
|
816 | 817 | @wireprotocommand('debugwireargs', 'one two *') |
|
817 | 818 | def debugwireargs(repo, proto, one, two, others): |
General Comments 0
You need to be logged in to leave comments.
Login now