[PATCH 2 of 2 V2] lfs: register the flag processors per repository

Matt Harbison mharbison72 at gmail.com
Fri Oct 12 08:05:09 EDT 2018


> On Oct 12, 2018, at 3:45 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
>> On Wed, 10 Oct 2018 23:36:21 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison at yahoo.com>
>> # Date 1538626646 14400
>> #      Thu Oct 04 00:17:26 2018 -0400
>> # Node ID 5c2d039bb214924cd35688c51136fab31c40f6b9
>> # Parent  2ac7a5b9a3d794c5357373d75a67e1032ae68a97
>> lfs: register the flag processors per repository
> 
>> I didn't see a good way to get a handle to the current module to compare
>> when walking the enabled extensions.
> 
> Perhaps, sys.modules[__name__] can be used.
> 
>> +def _resolverevlogstorevfsoptions(orig, ui, requirements, features):
>> +    opts = orig(ui, requirements, features)
>> +    for name, module in extensions.extensions(ui):
>> +        if name == b'lfs':
>> +            if revlog.REVIDX_EXTSTORED in opts[b'flagprocessors']:
>> +                msg = (_(b"cannot register multiple processors on flag '%#x'.")
>> +                       % (flag))
>                             ^^^^
> Copy-paste error.
> 
>> +                raise error.Abort(msg)
> 
> Was it intentional to change ProgrammingError to Abort? I think that's somewhat
> correct, but just wanna confirm.

I don’t think is was changed:

    https://www.mercurial-scm.org/repo/hg/file/e67522413ca8/mercurial/revlog.py#l162

I guess the difference is registering unknown flags is never right, but registering the same flag twice might be a configuration error, like enabling conflicting extensions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20181012/95caf473/attachment-0001.html>


More information about the Mercurial-devel mailing list