# HG changeset patch # User Dirkjan Ochtman # Date 1214991079 -7200 # Node ID c228ae4bc89cc54d686e2ba8a22527c14f1c89f8 # Parent c64f35a96448e2e69864207de2aaa1f17d0b9f24# Parent 8ff321a381d090f4a2c6e03625f35dbd24aea45d merge the backout head diff -r c64f35a96448 -r c228ae4bc89c mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py Wed Jul 02 09:31:13 2008 +0200 +++ b/mercurial/hgweb/protocol.py Wed Jul 02 11:31:19 2008 +0200 @@ -193,4 +193,5 @@ def stream_out(repo, req): req.respond(HTTP_OK, HGTYPE) - return streamclone.stream_out(repo, untrusted=True) + streamclone.stream_out(repo, req, untrusted=True) + return [] diff -r c64f35a96448 -r c228ae4bc89c mercurial/sshserver.py --- a/mercurial/sshserver.py Wed Jul 02 09:31:13 2008 +0200 +++ b/mercurial/sshserver.py Wed Jul 02 11:31:19 2008 +0200 @@ -204,6 +204,4 @@ os.unlink(tempname) def do_stream_out(self): - for chunk in streamclone.stream_out(self.repo): - self.fout.write(chunk) - self.fout.flush() + streamclone.stream_out(self.repo, self.fout) diff -r c64f35a96448 -r c228ae4bc89c mercurial/streamclone.py --- a/mercurial/streamclone.py Wed Jul 02 09:31:13 2008 +0200 +++ b/mercurial/streamclone.py Wed Jul 02 11:31:19 2008 +0200 @@ -51,12 +51,12 @@ # # server writes out raw file data. -def stream_out(repo, untrusted=False): +def stream_out(repo, fileobj, untrusted=False): '''stream out all metadata files in repository. writes to file-like object, must support write() and optional flush().''' if not repo.ui.configbool('server', 'uncompressed', untrusted=untrusted): - yield '1\n' + fileobj.write('1\n') return # get consistent snapshot of repo. lock during scan so lock not @@ -67,10 +67,10 @@ repolock = repo.lock() except (lock.LockHeld, lock.LockUnavailable), inst: repo.ui.warn('locking the repository failed: %s\n' % (inst,)) - yield '2\n' + fileobj.write('2\n') return - yield '0\n' + fileobj.write('0\n') repo.ui.debug('scanning\n') entries = [] total_bytes = 0 @@ -83,9 +83,11 @@ repo.ui.debug('%d files, %d bytes to transfer\n' % (len(entries), total_bytes)) - yield '%d %d\n' % (len(entries), total_bytes) + fileobj.write('%d %d\n' % (len(entries), total_bytes)) for name, size in entries: repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) - yield '%s\0%d\n' % (name, size) + fileobj.write('%s\0%d\n' % (name, size)) for chunk in util.filechunkiter(repo.sopener(name), limit=size): - yield chunk + fileobj.write(chunk) + flush = getattr(fileobj, 'flush', None) + if flush: flush()