Gregory Szorc <gregory.szorc@gmail.com> [Mon, 24 Sep 2018 09:37:19 -0700] rev 39857
upgrade: report size of backing files, not internal storage size
upgrade.py is the only consumer of filelog.index, which I'd like
to eliminate from the file storage interface.
This commit changes the upgrade code to report the storage size
of files by looking at the size of the files backing its storage
instead of looking at the index.
I'm not convinced the approach in this patch will live very long
because it is relying on low-level attributes like "opener" and
"files," which may behave very differently on non-revlog storage.
But the data is only used for reporting purposes and it does get
us one step closer to eliminating "index."
A side-effect of this change is we now report the size of the revlog
index data - not just the revision data. I think this is more
accurate.
Differential Revision: https://phab.mercurial-scm.org/D4717
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 20 Sep 2018 18:07:42 -0700] rev 39856
filelog: store filename directly on revlog instance
This attribute is only used by LFS. It is used by one of the revlog
flag processor functions, which gets an instance of the revlog - not
the file storage type. So, it makes sense to store this attribute on
the revlog instead of the filelog.
With this change, I'm pretty confident that LFS is no longer directly
accessing file storage interface members that are revlog centric. i.e.
it gets us one step closer to eliminating revlog-centric APIs from the
file storage interface!
Differential Revision: https://phab.mercurial-scm.org/D4715
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 20 Sep 2018 17:47:34 -0700] rev 39855
lfs: access revlog directly
LFS is monkeypatching filelog.filelog and is then accessing
various filelog attributes in the monkeypatched function. This is all
fine.
But some of the attributes being accessed by LFS are revlog centric
and shouldn't be exposed on the file storage interface.
This commit changes the monkeypatched functions to access proxied
attributes on self._revlog instead of self.
This should be safe to do because non-revlog repositories should not
be using filelog instances: instead they should have a separate class
to represent file storage. So it is reasonable for LFS to assume the
_revlog attribute exists and points to a revlog.
Differential Revision: https://phab.mercurial-scm.org/D4714
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 20 Sep 2018 15:30:00 -0700] rev 39854
largefiles: automatically load largefiles extension when required (BC)
This is very similar to what we just did for LFS but for largefiles.
See recent commit messages for the rationale here.
Differential Revision: https://phab.mercurial-scm.org/D4713
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 20 Sep 2018 15:18:13 -0700] rev 39853
lfs: don't add extension to hgrc after clone or share (BC)
Now that repository loading in core supports automatically loading
the lfs extension when the "lfs" requirement is present, we no
longer need to update the .hg/hgrc of newly-created repos to load
the lfs extension!
I'm marking this as BC because it is a change in behavior. But users
should not notice unless they create an LFS repo with new Mercurial
and then attempt to use it with an old versions that doesn't support
automatic extension loading.
Differential Revision: https://phab.mercurial-scm.org/D4712
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 20 Sep 2018 15:06:43 -0700] rev 39852
localrepo: automatically load lfs extension when required (BC)
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