[PATCH 1 of 1] clone: only use stream when we understand the revlog format
Sune Foldager
cryo at cyanite.org
Tue Aug 31 04:09:57 CDT 2010
On 31-08-2010 10:52, Benoit Boissinot wrote:
> On Mon, Aug 30, 2010 at 06:21:40PM +0200, Sune Foldager wrote:
>> class localrepository(repo.repository):
>> capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey'))
>> - supported = set('revlogv1 store fncache shared parentdelta'.split())
>> + localsupported = set(('store', 'fncache', 'shared'))
>
> not of fan of the variable name, might be better to do it the other way
> round:
> supportedformats = set(('revlogv1', 'parentdelta'))
> supported = supportedformats | ...
Not sure 'supportedformats' is much better, but whatever works.
>> def __init__(self, baseui, path=None, create=0):
>> repo.repository.__init__(self)
>> @@ -95,6 +96,8 @@
>> self.sopener.options = {}
>> if 'parentdelta' in requirements:
>> self.sopener.options['parentdelta'] = 1
>> + reqs = ','.join(r for r in requirements if r not in self.localsupported)
>> + self.capabilities.add('requires=' + reqs)
>
> is that needed? shouldn't that go only in wireproto.py?
Can't the remote repository be a localrepo-instance? Then I think it
will be needed, no?
> (and streamcaps=... might be a better capability name, like the original
> stream= but we add more useful information and this time we make sure
> the clients checks it...)
Does this mean that you, refering to my point 4, think we should join
the two capabilities?
>> - if stream and not heads and remote.capable('stream'):
>> - return self.stream_in(remote)
>> + if stream and not heads and remote.capable('stream2'):
>> + reqs = remote.capable('requires')
>> + if reqs:
>> + reqs = set(reqs.split(','))
>> + if not reqs - self.supported:
>> + return self.stream_in(remote)
>
> We still have a problem with the code flow, when we hit
> localrepo.clone() we already wrote the requirements while they can
> depend on the remote repo.
Yes, we will probably need to rewrite requirements in this case, and
rewrite store-opener-options as well.... maybe. Does the parentdelta
store option force parentdelta-interpretation; isn't there a revlog flag
for it?
>> --- a/mercurial/wireproto.py
>> +++ b/mercurial/wireproto.py
>> @@ -172,8 +172,11 @@
>> def capabilities(repo, proto):
>> caps = 'lookup changegroupsubset branchmap pushkey'.split()
>> if _allowstream(repo.ui):
>> - caps.append('stream=%d' % repo.changelog.version)
>> + caps.append('stream2')
>> caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
>> + reqs = repo.capable('requires')
>> + if reqs:
>> + caps.append('requires=%s' % reqs)
>> return ' '.join(caps)
>
> We should keep stream if the repo is compatible.
How should the server know if the repo is compatible? It should check
requirements against a hard-coded set of "old supported stuff". Is that
worth it? Won't people always be using the new formats with new hg init's?
More information about the Mercurial-devel
mailing list