##// END OF EJS Templates
merge the backout head
Dirkjan Ochtman -
r6795:c228ae4b merge default
parent child Browse files
Show More
@@ -193,4 +193,5 b' def unbundle(repo, req):'
193
193
194 def stream_out(repo, req):
194 def stream_out(repo, req):
195 req.respond(HTTP_OK, HGTYPE)
195 req.respond(HTTP_OK, HGTYPE)
196 return streamclone.stream_out(repo, untrusted=True)
196 streamclone.stream_out(repo, req, untrusted=True)
197 return []
@@ -204,6 +204,4 b' class sshserver(object):'
204 os.unlink(tempname)
204 os.unlink(tempname)
205
205
206 def do_stream_out(self):
206 def do_stream_out(self):
207 for chunk in streamclone.stream_out(self.repo):
207 streamclone.stream_out(self.repo, self.fout)
208 self.fout.write(chunk)
209 self.fout.flush()
@@ -51,12 +51,12 b' def walkrepo(root):'
51 #
51 #
52 # server writes out raw file data.
52 # server writes out raw file data.
53
53
54 def stream_out(repo, untrusted=False):
54 def stream_out(repo, fileobj, untrusted=False):
55 '''stream out all metadata files in repository.
55 '''stream out all metadata files in repository.
56 writes to file-like object, must support write() and optional flush().'''
56 writes to file-like object, must support write() and optional flush().'''
57
57
58 if not repo.ui.configbool('server', 'uncompressed', untrusted=untrusted):
58 if not repo.ui.configbool('server', 'uncompressed', untrusted=untrusted):
59 yield '1\n'
59 fileobj.write('1\n')
60 return
60 return
61
61
62 # get consistent snapshot of repo. lock during scan so lock not
62 # get consistent snapshot of repo. lock during scan so lock not
@@ -67,10 +67,10 b' def stream_out(repo, untrusted=False):'
67 repolock = repo.lock()
67 repolock = repo.lock()
68 except (lock.LockHeld, lock.LockUnavailable), inst:
68 except (lock.LockHeld, lock.LockUnavailable), inst:
69 repo.ui.warn('locking the repository failed: %s\n' % (inst,))
69 repo.ui.warn('locking the repository failed: %s\n' % (inst,))
70 yield '2\n'
70 fileobj.write('2\n')
71 return
71 return
72
72
73 yield '0\n'
73 fileobj.write('0\n')
74 repo.ui.debug('scanning\n')
74 repo.ui.debug('scanning\n')
75 entries = []
75 entries = []
76 total_bytes = 0
76 total_bytes = 0
@@ -83,9 +83,11 b' def stream_out(repo, untrusted=False):'
83
83
84 repo.ui.debug('%d files, %d bytes to transfer\n' %
84 repo.ui.debug('%d files, %d bytes to transfer\n' %
85 (len(entries), total_bytes))
85 (len(entries), total_bytes))
86 yield '%d %d\n' % (len(entries), total_bytes)
86 fileobj.write('%d %d\n' % (len(entries), total_bytes))
87 for name, size in entries:
87 for name, size in entries:
88 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
88 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
89 yield '%s\0%d\n' % (name, size)
89 fileobj.write('%s\0%d\n' % (name, size))
90 for chunk in util.filechunkiter(repo.sopener(name), limit=size):
90 for chunk in util.filechunkiter(repo.sopener(name), limit=size):
91 yield chunk
91 fileobj.write(chunk)
92 flush = getattr(fileobj, 'flush', None)
93 if flush: flush()
General Comments 0
You need to be logged in to leave comments. Login now