From af0ba8e8394c68e2ac4bfceeb604c1197f8245cc Mon Sep 17 00:00:00 2001 From: Mike Edgar Date: Wed, 21 Jan 2015 16:35:09 -0500 Subject: [PATCH] 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 --- mercurial/mdiff.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py index fe990c4868..d63f4915dd 100644 --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -367,6 +367,9 @@ def get_matching_blocks(a, b): def trivialdiffheader(length): return struct.pack(">lll", 0, 0, length) +def replacediffheader(oldlen, newlen): + return struct.pack(">lll", 0, oldlen, newlen) + patches = mpatch.patches patchedsize = mpatch.patchedsize textdiff = bdiff.bdiff