Patchwork [1,of,6,censor,RFC] mdiff: add helper for making deltas which replace the full text of a revision

login
register
mail settings
Submitter adgar@google.com
Date Jan. 23, 2015, 11:53 p.m.
Message ID <c918140288f12c3b5fb4.1422057201@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/7549/
State Superseded
Commit eb2482644e5a4325d51119563d647b78272a3944
Headers show

Comments

adgar@google.com - Jan. 23, 2015, 11:53 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1421876109 18000
#      Wed Jan 21 16:35:09 2015 -0500
# Node ID c918140288f12c3b5fb408da89512baff72ffd17
# Parent  22a979d1ae569d1cd87f166b5600def0fe93efb3
mdiff: add helper for making deltas which replace the full text of a revision

This helper will be used initially for censor-aware delta generation. Deltas
which replace the full contents of the base revision are guaranteed to apply
correctly regardless of whether the delta recipient has censored the base.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
Sean Farley - Jan. 24, 2015, 12:02 a.m.
Mike Edgar writes:

> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1421876109 18000
> #      Wed Jan 21 16:35:09 2015 -0500
> # Node ID c918140288f12c3b5fb408da89512baff72ffd17
> # Parent  22a979d1ae569d1cd87f166b5600def0fe93efb3
> mdiff: add helper for making deltas which replace the full text of a revision
>
> This helper will be used initially for censor-aware delta generation. Deltas
> which replace the full contents of the base revision are guaranteed to apply
> correctly regardless of whether the delta recipient has censored the base.
>
> For background and broader design of the censorship feature, see:
> http://mercurial.selenic.com/wiki/CensorPlan

I realize this is RFC but Matt usually suggests holding off on these
types of patches while in a code freeze so that contributors can
concentrate on bug fixes.
Martin von Zweigbergk - Jan. 24, 2015, 4:50 a.m.
The new function doesn't seem to get used in patch 2. I think it would be
easier to review if this patch was folded into 3/6, so the reviewer can
easily see how the function is used.

On Fri Jan 23 2015 at 3:57:02 PM Mike Edgar <adgar@google.com> wrote:

> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1421876109 18000
> #      Wed Jan 21 16:35:09 2015 -0500
> # Node ID c918140288f12c3b5fb408da89512baff72ffd17
> # Parent  22a979d1ae569d1cd87f166b5600def0fe93efb3
> mdiff: add helper for making deltas which replace the full text of a
> revision
>
> This helper will be used initially for censor-aware delta generation.
> Deltas
> which replace the full contents of the base revision are guaranteed to
> apply
> correctly regardless of whether the delta recipient has censored the base.
>
> For background and broader design of the censorship feature, see:
> http://mercurial.selenic.com/wiki/CensorPlan
>
> diff -r 22a979d1ae56 -r c918140288f1 mercurial/mdiff.py
> --- a/mercurial/mdiff.py        Mon Jan 12 15:29:36 2015 -0500
> +++ b/mercurial/mdiff.py        Wed Jan 21 16:35:09 2015 -0500
> @@ -367,6 +367,9 @@
>  def trivialdiffheader(length):
>      return struct.pack(">lll", 0, 0, length)
>
> +def replacediffheader(old, new):
> +    return struct.pack(">lll", 0, old, new)
> +
>  patches = mpatch.patches
>  patchedsize = mpatch.patchedsize
>  textdiff = bdiff.bdiff
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff -r 22a979d1ae56 -r c918140288f1 mercurial/mdiff.py
--- a/mercurial/mdiff.py	Mon Jan 12 15:29:36 2015 -0500
+++ b/mercurial/mdiff.py	Wed Jan 21 16:35:09 2015 -0500
@@ -367,6 +367,9 @@ 
 def trivialdiffheader(length):
     return struct.pack(">lll", 0, 0, length)
 
+def replacediffheader(old, new):
+    return struct.pack(">lll", 0, old, new)
+
 patches = mpatch.patches
 patchedsize = mpatch.patchedsize
 textdiff = bdiff.bdiff