[PATCH 1 of 4] config: don't read the same config file twice

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Sep 29 17:52:24 CDT 2014

On 09/29/2014 03:48 PM, Mads Kiilerich wrote:
> On 09/30/2014 12:24 AM, Pierre-Yves David wrote:
>> On 09/24/2014 06:33 PM, Mads Kiilerich wrote:
>>> # HG changeset patch
>>> # User Mads Kiilerich <madski at unity3d.com>
>>> # Date 1409859395 -7200
>>> #      Thu Sep 04 21:36:35 2014 +0200
>>> # Node ID e04d746df4b9a7c5ef32b0bf70284e3dd8402791
>>> # Parent  fa3181323c0aa9b2d2c2f81a7d68d57bd3a7a515
>>> config: don't read the same config file twice
>> Ok, I had a deeper look into this and this patch seems obviously
>> correct. However, could we get a simpler and more robust version of
>> this by checking is a path is already present before appending it.
>> How complicated would that be?
> That would be complication level 7! ;-)
> The patch I propose checks for the root cause of duplication and
> prevents adding it. I don't think it can be done any shorter or more
> spot-on.
> It is very unlikely that same path is added twice for other reasons.
> Additional de-duplication would thus be redundant.
> Removing duplicates after they have been added would not be complicated.
> But it would be significantly more complex than what I propose. It would
> also be more expensive (but with very low constants). I guess the
> simplest and most efficient solution would be a O(n*2) looping through
> the list. It would add complexity with no gain. I would rather not go
> there.

Do we expect people to have path lenght were N² matters? Anyway I've 
queued this first one. As change are requested for 2 and 3. This 
conclude this round of review.

Pierre-Yves David

More information about the Mercurial-devel mailing list