Skip to content
Snippets Groups Projects
  • Gregory Szorc's avatar
    2c2fadbc
    localrepo: automatically load lfs extension when required (BC) · 2c2fadbc
    Gregory Szorc authored
    If an unrecognized requirement is present (possibly due to an unloaded
    extension), the user will get an error message telling them to go to
    https://mercurial-scm.org/wiki/MissingRequirement for more info.
    
    And some requirements clearly map to known extensions shipped by
    Mercurial.
    
    This commit teaches repository loading to automatically map
    requirements to extensions. We implement support for loading the
    lfs extension when the "lfs" requirement is present.
    
    This behavior feels more user-friendly to me and I'm having trouble
    coming up with a compelling reason to not do it. The strongest
    argument I have against is that - strictly speaking - requirements
    are general repository features and there could be N providers of that
    feature. e.g. in the case of LFS, there could be another extension
    implementing LFS support. And the user would want to use this
    non-official extension rather than the built-in one. The way this
    patch implements things, the non-official extension could be
    missing and Mercurial would load the official lfs extension, leading
    to unexpected behavior. But this feels like a highly marginal use
    case to me and doesn't outweigh the user benefit of "it just works."
    If someone really wanted to e.g. use a custom LFS extension, they
    could prevent the built-in one from being loaded by either defining
    "extensions.lfs=/path/to/custom/extension" or "extensions.lfs=!",
    as the automatic extension loading only occurs if there is no config
    entry for that extension.
    
    Differential Revision: https://phab.mercurial-scm.org/D4711
    2c2fadbc
    History
    localrepo: automatically load lfs extension when required (BC)
    Gregory Szorc authored
    If an unrecognized requirement is present (possibly due to an unloaded
    extension), the user will get an error message telling them to go to
    https://mercurial-scm.org/wiki/MissingRequirement for more info.
    
    And some requirements clearly map to known extensions shipped by
    Mercurial.
    
    This commit teaches repository loading to automatically map
    requirements to extensions. We implement support for loading the
    lfs extension when the "lfs" requirement is present.
    
    This behavior feels more user-friendly to me and I'm having trouble
    coming up with a compelling reason to not do it. The strongest
    argument I have against is that - strictly speaking - requirements
    are general repository features and there could be N providers of that
    feature. e.g. in the case of LFS, there could be another extension
    implementing LFS support. And the user would want to use this
    non-official extension rather than the built-in one. The way this
    patch implements things, the non-official extension could be
    missing and Mercurial would load the official lfs extension, leading
    to unexpected behavior. But this feels like a highly marginal use
    case to me and doesn't outweigh the user benefit of "it just works."
    If someone really wanted to e.g. use a custom LFS extension, they
    could prevent the built-in one from being loaded by either defining
    "extensions.lfs=/path/to/custom/extension" or "extensions.lfs=!",
    as the automatic extension loading only occurs if there is no config
    entry for that extension.
    
    Differential Revision: https://phab.mercurial-scm.org/D4711