[PATCH 2 of 2] bundle2: add support for changegroup2

sune.foldager at me.com sune.foldager at me.com
Tue Sep 2 06:28:39 CDT 2014


> +    def deltaparent(self, revlog, rev, p1, p2, prev):
> +        dp = revlog.deltaparent(rev)
> +        #print 'rev %d dp %d p1 %d p2 %d prev %d' % (rev, dp, p1, p2, prev)
> +        # avoid storing full revisions; pick prev in those cases
> +        # also pick prev when we can't be sure remote has dp
> +        if dp == nullrev or (dp != p1 and dp != p2 and dp != prev):
> +            return prev
> +        return dp

This should probably go in the commit message ;) but, the rationale for choosing the delta parent like this is the following:

1. Many times, full revisions are stored in the revlog because the chain length max. is exceeded. In that case we would prefer a delta in the changegroup to make it smaller.
2. Some chains are quite small in the beginning, or when the data amount is small.
3. The difference between a really poor delta (a kill everything and insert everything) and a full version is small.
4. We can change this algorithm at any time without breaking anything :)

-Sune



More information about the Mercurial-devel mailing list