[PATCH 3 of 3 V4] largefiles: setup "largefiles" feature in each repositories individually

Siddharth Agarwal sid0 at fb.com
Tue Sep 24 17:33:47 CDT 2013


On 09/24/2013 02:05 PM, Siddharth Agarwal wrote:
> On 09/21/2013 05:39 AM, FUJIWARA Katsunori wrote:
>> +def featuresetup(ui, supported):
>> +    for name, module in extensions.extensions(ui):
>> +        if __name__ == module.__name__:
>> +            # don't die on seeing a repo with the largefiles 
>> requirement
>> +            supported |= set(['largefiles'])
>> +            return
>
> Is there a more elegant way to do this? Seems like basically every 
> extension that adds something to the supported list will need to do 
> precisely this.

Also, it seems like if the extension relies on the requires file to 
figure out when to disable itself, this shouldn't be necessary at all. 
For example, we have an out-of-tree extension called lz4revlog that 
switches to a different compression algorithm for the revlog. The 
extension looks at whether its corresponding entry is present in the 
requires file, and if it is, doesn't use the alternate compression 
algorithm to compress itself.

I guess there's an edge case here where you operate on two repositories:
repo 1 has lz4revlog enabled
repo 2 has lz4revlog disabled but has it listed in requires

then operating on repo 2 alone would fail, but if you operate on repo 1 
and 2 together within the same process, things would work.

... but then what happens if two repositories enable two different 
versions of lz4revlog? Does the first one that's initialized win? 
http://selenic.com/repo/hg/file/50d721553198/mercurial/extensions.py#l67 
seems to indicate that that's the case. Why is that different from the 
one enabled, one disabled case?


More information about the Mercurial-devel mailing list