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

Matt Mackall mpm at selenic.com
Tue Sep 14 17:43:18 CDT 2010


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?

> 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 check it; 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. 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?

> +    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.

I think this should be two functions, apply and write. Or possibly even
read and write, in which case clone/create should write out requirements
then read to apply their effects.

Let's do this first, preferably in two pieces:

- new requirements methods
- the wireproto fix

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list