[PATCH 7 of 7] clone: only use stream when we understand the revlog format

Sune Foldager cryo at cyanite.org
Wed Sep 15 03:20:07 CDT 2010


On 15-09-2010 00:43, Matt Mackall wrote:
> On Tue, 2010-09-14 at 11:56 +0200, Sune Foldager wrote:
>> # HG changeset patch
>> # User Sune Foldager<cryo at cyanite.org>
>> # Date 1283429388 -7200
>> # Node ID 467dca2391c68e7b418a6fbfc18099a3b3fea5fb
>> # Parent  6c95703db2ceff035bbcece54aa984da493e67f3
>> clone: only use stream when we understand the revlog format
>
> Seems like this patch ought to come first, no?

If you prefer.

>> This patch removes the 'stream' capability whenever we use a non-basic revlog
>> format, to prevent old clients from receiving incorrect data. Otherwise, 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.
>
> And what happens with old clients? What happens with new servers serving
> old repos to old clients?

Everything works as normal. The server advertises 'stream', and the 
client uses it as normal.

>> +    def _setrequirements(self, requirements, writeback=True):
>> +        self.requirements = requirements
>> +        self.sopener.options = {}
>> +        if 'parentdelta' in requirements:
>> +            self.sopener.options['parentdelta'] = 1
>> +        if 'lwcopy' in requirements:
>> +            self.sopener.options['lwcopy'] = 1
>> +        if writeback:
>> +            reqfile = self.opener("requires", "w")
>> +            for r in requirements:
>> +                reqfile.write("%s\n" % r)
>> +            reqfile.close()
>
> This mixes up two independent notions: a) writing out requirements and
> b) activating options related to requirements (usually when reading
> requirements in). Writeback implies that we're, you know, writing
> something back after reading it, which basically never happens.

We do write something. I don't know if "back" is right, we could call it 
simply "store" instead. Separating it into two methods is fine also.

> Let's do this first, preferably in two pieces:
>
> - new requirements methods
> - the wireproto fix

If you prefer.

/Sune


More information about the Mercurial-devel mailing list