[PATCH v3] diff: search beyond ancestor when detecting renames

Mads Kiilerich mads at kiilerich.com
Mon Jan 13 07:34:32 CST 2014


On 01/13/2014 08:01 AM, Pierre-Yves David wrote:
> On Sun, Jan 12, 2014 at 08:01:09PM +0100, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski at unity3d.com>
>> # Date 1384634789 18000
>> #      Sat Nov 16 15:46:29 2013 -0500
>> # Node ID 41372107d64bc9071b4ff24046965c3c59d54c38
>> # Parent  57abc08c399b28aa86248f6db2cc63a7cf0b0f13
>> diff: search beyond ancestor when detecting renames
>>
>> This removes an optimization that was introduced in 91eb4512edd0 but was too
>> aggressive - as indicated by how it changed test-mq-merge.t .
> Patch looks good to me. A bit worried about the performance hit. Did you
> gathered some number?

No. But this is a matter of correctness so a performance hit would be 
ok. Incorrect diffs has in some cases made a big impact on our team 
performance when reviewing moved files ;-).

The code already walks the filelogs back to the ancestor for all missing 
files.
The change adds a single call to _findlimit. It will efficiently walk 
the changeset DAG back to the ancestor (and a bit further) ... and we 
will in worst case walk the filelogs one extra step back.
I don't expect that to be a problem.

Some quick benchmarks shows something like 2% extra for a huge diff --stat.

This code could be optimized for some trivial cases (where it probably 
doesn't matter anyway) by only computing the limit if there actually is 
missing files ... but I doubt that would be worth it.

/Mads



More information about the Mercurial-devel mailing list