( )⚙ D4711 localrepo: automatically load lfs extension when required (BC)

This is an archive of the discontinued Mercurial Phabricator instance.

localrepo: automatically load lfs extension when required (BC)
ClosedPublic

Authored by indygreg on Sep 24 2018, 12:12 PM.

Details

Summary

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.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.Sep 24 2018, 12:12 PM
mharbison72 accepted this revision.Sep 25 2018, 12:23 AM
mharbison72 added a subscriber: mharbison72.

I agree with the rationale. Thanks for this.

I guess we need to figure out how to handle push/pull upgrades before doing the same to clone, because all 3 need a wire protocol capability to work. And if we unconditionally register that in core, we bypass the nice error message that comes out (and the early failure I think).

I actually wrote the patch to add the lfs requirement on clone. However, the way lfs is advertised on the server is a bit buggy. See https://hg.mozilla.org/users/gszorc_mozilla.com/hg/rev/d39bf70535a5.

I could solve this problem if I wanted to. But I have other aspects of the code I'd prefer to work on.

I actually wrote the patch to add the lfs requirement on clone. However, the way lfs is advertised on the server is a bit buggy. See https://hg.mozilla.org/users/gszorc_mozilla.com/hg/rev/d39bf70535a5.
I could solve this problem if I wanted to. But I have other aspects of the code I'd prefer to work on.

Maybe that got rewritten? I get this error:

An error occurred while processing your request

filtered revision 'd39bf70535a5' (not in 'served' subset)

I can take a look at it so you don’t get too far off track.

It did. https://hg.mozilla.org/users/gszorc_mozilla.com/hg/rev/65175a0 is the new version. (It probably won't last through the day though.)

(Maybe hgweb could link obsolescence changesets to their successors...)

This revision was automatically updated to reflect the committed changes.