[PATCH 2 of 2 censor RFC v2] revlog: _addrevision creates full-replace deltas based on censored revisions

Augie Fackler raf at durin42.com
Wed Feb 11 08:42:12 CST 2015


On Feb 10, 2015, at 6:16 PM, Mike Edgar <adgar at google.com> wrote:

> # HG changeset patch
> # User Mike Edgar <adgar at google.com>
> # Date 1421878297 18000
> #      Wed Jan 21 17:11:37 2015 -0500
> # Node ID 4819c113f384392de5d0116d328d26edfb142e75
> # Parent  3a1c2083548586a5ad0afe0cfaca2d070984ce61
> revlog: _addrevision creates full-replace deltas based on censored revisions

Queued these, thanks.

> 
> A delta against a censored revision is either received through exchange and
> written blindly to a revlog, or it is created by the revlog itself. This
> change ensures the latter process creates deltas which fully replace all
> data in a censored base using a single patch operation.
> 
> Recipients of a delta against a censored base will verify that the delta is in
> this full-replace format. Other recipients will use the delta as normal.
> 
> For background and broader design of the censorship feature, see:
> http://mercurial.selenic.com/wiki/CensorPlan
> 
> diff -r 3a1c20835485 -r 4819c113f384 mercurial/revlog.py
> --- a/mercurial/revlog.py	Fri Feb 06 01:38:16 2015 +0000
> +++ b/mercurial/revlog.py	Wed Jan 21 17:11:37 2015 -0500
> @@ -1261,8 +1261,14 @@
>                 delta = cachedelta[1]
>             else:
>                 t = buildtext()
> -                ptext = self.revision(self.node(rev))
> -                delta = mdiff.textdiff(ptext, t)
> +                if self.iscensored(rev):
> +                    # deltas based on a censored revision must replace the
> +                    # full content in one patch, so delta works everywhere
> +                    header = mdiff.replacediffheader(self.rawsize(rev), len(t))
> +                    delta = header + t
> +                else:
> +                    ptext = self.revision(self.node(rev))
> +                    delta = mdiff.textdiff(ptext, t)
>             data = self.compress(delta)
>             l = len(data[1]) + len(data[0])
>             if basecache[0] == rev:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150211/ac2d59d7/attachment.pgp>


More information about the Mercurial-devel mailing list