[PATCH 1 of 2 censor RFC v2] changegroup: clean up misnamed local variable in delta generation logic

Matt Mackall mpm at selenic.com
Wed Feb 25 18:26:20 CST 2015


On Fri, 2015-02-20 at 16:54 -0500, Mike Edgar wrote:
> # HG changeset patch
> # User Mike Edgar <adgar at google.com>
> # Date 1424465057 18000
> #      Fri Feb 20 15:44:17 2015 -0500
> # Node ID 96a3db818b2ec56f420c677ca38ea34dc46af9ff
> # Parent  75f94dcf76fdfeaebeaaea279ca5b88e3bc8a20b
> changegroup: clean up misnamed local variable in delta generation logic
> 
> The actual changegroup delta that is produced is sometimes split across two
> variables, "prefix" and "delta"; othertimes, it is wholly contained in
> "delta". This is confusing and inhibits extension of this logic.

The reason for the original code is that sometimes a snapshot was, say,
1G.. and adding 12 bytes to it meant 2G peak memory use (not to mention
some memcpy overhead). The split yield kept us at 1G, this brings us
back to 2.

> -            delta = revlog.revision(node)
> -            prefix = mdiff.trivialdiffheader(len(delta))
> +            snapshot = revlog.revision(node)
> +            delta = mdiff.trivialdiffheader(len(snapshot)) + snapshot

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list