Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 12296:d7fff529d85d
clone: only use stream when we understand the revlog format
This patch fixes issues with stream cloning in the presense of parentdelta,
lwcopy and similar additions that change the interpretation of the revlog
format, or the format itself.
Currently, the stream capability is sent like this:
stream=<version of changelog>
But the client doesn't actually check the version number; also, it only checks
the changelog and it doesn't capture the interpretation-changes and
flag-changes in parentdelta and lwcopy.
This patch removes the 'stream' capability whenever we use a non-basic revlog
format, to prevent old clients from receiving incorrect data. In those cases,
a new capability called 'streamreqs' is added instead. Instead of a revlog
version, it comes with a list of revlog-format relevant requirements, which
are a subset of the repository requirements, excluding things that are not
relevant for stream.
New clients use this to determine whether or not they can stream. Old clients
only look for the 'stream' capability, as always. New servers will still send
this when serving old repositories.
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Wed, 15 Sep 2010 11:06:22 +0200 |
parents | 6f833fc3ccab |
children | 6a6149487817 |
comparison
equal
deleted
inserted
replaced
12295:3388ab21d768 | 12296:d7fff529d85d |
---|---|
170 return "".join(r) | 170 return "".join(r) |
171 | 171 |
172 def capabilities(repo, proto): | 172 def capabilities(repo, proto): |
173 caps = 'lookup changegroupsubset branchmap pushkey'.split() | 173 caps = 'lookup changegroupsubset branchmap pushkey'.split() |
174 if _allowstream(repo.ui): | 174 if _allowstream(repo.ui): |
175 caps.append('stream=%d' % repo.changelog.version) | 175 requiredformats = repo.requirements & repo.supportedformats |
176 # if our local revlogs are just revlogv1, add 'stream' cap | |
177 if not requiredformats - set(('revlogv1',)): | |
178 caps.append('stream') | |
179 # otherwise, add 'streamreqs' detailing our local revlog format | |
180 else: | |
181 caps.append('streamreqs=%s' % ','.join(requiredformats)) | |
176 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) | 182 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) |
177 return ' '.join(caps) | 183 return ' '.join(caps) |
178 | 184 |
179 def changegroup(repo, proto, roots): | 185 def changegroup(repo, proto, roots): |
180 nodes = decodelist(roots) | 186 nodes = decodelist(roots) |