Mercurial > hg
changeset 30014:d34cf260d15b
wireproto: rename argument to groupchunks()
groupchunks() is a generic "turn a file object into a generator"
function. It isn't limited to changegroups. Rename the argument
and update the docstring to reflect this.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 25 Sep 2016 12:20:31 -0700 |
parents | 1659549870e1 |
children | 96b2dd3b184d |
files | mercurial/hgweb/protocol.py mercurial/sshserver.py mercurial/wireproto.py |
diffstat | 3 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/protocol.py Sun Sep 25 13:20:55 2016 -0700 +++ b/mercurial/hgweb/protocol.py Sun Sep 25 12:20:31 2016 -0700 @@ -73,13 +73,13 @@ val = self.ui.fout.getvalue() self.ui.ferr, self.ui.fout = self.oldio return val - def groupchunks(self, cg): + def groupchunks(self, fh): # Don't allow untrusted settings because disabling compression or # setting a very high compression level could lead to flooding # the server's network or CPU. z = zlib.compressobj(self.ui.configint('server', 'zliblevel', -1)) while True: - chunk = cg.read(32768) + chunk = fh.read(32768) if not chunk: break data = z.compress(chunk)
--- a/mercurial/sshserver.py Sun Sep 25 13:20:55 2016 -0700 +++ b/mercurial/sshserver.py Sun Sep 25 12:20:31 2016 -0700 @@ -68,8 +68,8 @@ def redirect(self): pass - def groupchunks(self, changegroup): - return iter(lambda: changegroup.read(4096), '') + def groupchunks(self, fh): + return iter(lambda: fh.read(4096), '') def sendresponse(self, v): self.fout.write("%d\n" % len(v))
--- a/mercurial/wireproto.py Sun Sep 25 13:20:55 2016 -0700 +++ b/mercurial/wireproto.py Sun Sep 25 12:20:31 2016 -0700 @@ -78,10 +78,11 @@ # """ # raise NotImplementedError() - def groupchunks(self, cg): - """return 4096 chunks from a changegroup object + def groupchunks(self, fh): + """Generator of chunks to send to the client. - Some protocols may have compressed the contents.""" + Some protocols may have compressed the contents. + """ raise NotImplementedError() class remotebatch(peer.batcher):