comparison mercurial/localrepo.py @ 2621:5a5852a417b1

clone: disable stream support on server side by default. enable in hgrc like this: [server] stream=True
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Sat, 15 Jul 2006 16:06:35 -0700
parents 479e26afa10f
children 5c10b7ed3411
comparison
equal deleted inserted replaced
2620:de82749d3a71 2621:5a5852a417b1
2202 if errors[0]: 2202 if errors[0]:
2203 self.ui.warn(_("%d integrity errors encountered!\n") % errors[0]) 2203 self.ui.warn(_("%d integrity errors encountered!\n") % errors[0])
2204 return 1 2204 return 1
2205 2205
2206 def stream_in(self, remote): 2206 def stream_in(self, remote):
2207 fp = remote.stream_out()
2208 resp = int(fp.readline())
2209 if resp != 0:
2210 raise util.Abort(_('operation forbidden by server'))
2207 self.ui.status(_('streaming all changes\n')) 2211 self.ui.status(_('streaming all changes\n'))
2208 fp = remote.stream_out()
2209 total_files, total_bytes = map(int, fp.readline().split(' ', 1)) 2212 total_files, total_bytes = map(int, fp.readline().split(' ', 1))
2210 self.ui.status(_('%d files to transfer, %s of data\n') % 2213 self.ui.status(_('%d files to transfer, %s of data\n') %
2211 (total_files, util.bytecount(total_bytes))) 2214 (total_files, util.bytecount(total_bytes)))
2212 start = time.time() 2215 start = time.time()
2213 for i in xrange(total_files): 2216 for i in xrange(total_files):
2228 def clone(self, remote, heads=[], stream=False): 2231 def clone(self, remote, heads=[], stream=False):
2229 '''clone remote repository. 2232 '''clone remote repository.
2230 2233
2231 keyword arguments: 2234 keyword arguments:
2232 heads: list of revs to clone (forces use of pull) 2235 heads: list of revs to clone (forces use of pull)
2233 pull: force use of pull, even if remote can stream''' 2236 stream: use streaming clone if possible'''
2234 2237
2235 # now, all clients that can stream can read repo formats 2238 # now, all clients that can request uncompressed clones can
2236 # supported by all servers that can stream. 2239 # read repo formats supported by all servers that can serve
2240 # them.
2237 2241
2238 # if revlog format changes, client will have to check version 2242 # if revlog format changes, client will have to check version
2239 # and format flags on "stream" capability, and stream only if 2243 # and format flags on "stream" capability, and use
2240 # compatible. 2244 # uncompressed only if compatible.
2241 2245
2242 if stream and not heads and remote.capable('stream'): 2246 if stream and not heads and remote.capable('stream'):
2243 return self.stream_in(remote) 2247 return self.stream_in(remote)
2244 return self.pull(remote, heads) 2248 return self.pull(remote, heads)
2245 2249