comparison mercurial/httprepo.py @ 2439:e8c4f3d3df8c

extend network protocol to stop clients from locking servers now all repositories have capabilities slot, tuple with list of names. if 'unbundle' capability present, repo supports push where client does not need to lock server. repository classes that have unbundle capability also have unbundle method. implemented for ssh now, will be base for push over http. unbundle protocol acts this way. server tells client what heads it has during normal negotiate step. client starts unbundle by repeat server's heads back to it. if server has new heads, abort immediately. otherwise, transfer changes to server. once data transferred, server locks and checks heads again. if heads same, changes can be added. else someone else added heads, and server aborts. if client wants to force server to add heads, sends special heads list of 'force'.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 15 Jun 2006 16:37:23 -0700
parents ff2bac730b99
children c660691fb45d
comparison
equal deleted inserted replaced
2436:f910b91dd912 2439:e8c4f3d3df8c
69 return userpass + '@' + hostport 69 return userpass + '@' + hostport
70 return hostport 70 return hostport
71 71
72 class httprepository(remoterepository): 72 class httprepository(remoterepository):
73 def __init__(self, ui, path): 73 def __init__(self, ui, path):
74 self.capabilities = ()
74 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) 75 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
75 if query or frag: 76 if query or frag:
76 raise util.Abort(_('unsupported URL component: "%s"') % 77 raise util.Abort(_('unsupported URL component: "%s"') %
77 (query or frag)) 78 (query or frag))
78 if not urlpath: urlpath = '/' 79 if not urlpath: urlpath = '/'
232 raise IOError(None, _('connection ended unexpectedly')) 233 raise IOError(None, _('connection ended unexpectedly'))
233 yield zd.flush() 234 yield zd.flush()
234 235
235 return util.chunkbuffer(zgenerator(util.filechunkiter(f))) 236 return util.chunkbuffer(zgenerator(util.filechunkiter(f)))
236 237
238 def unbundle(self, cg, heads, source):
239 raise util.Abort(_('operation not supported over http'))
240
237 class httpsrepository(httprepository): 241 class httpsrepository(httprepository):
238 pass 242 pass