It is common for projects or companies to define/recommend
common customizations for Mercurial. However, distributing these
customizations can be difficult because there's no distribution
channel built into Mercurial itself. The "configexpress"
extension is making some inroads here. But it is geared towards
hgrc files. I think there's room to make certain customizations
outside of the config system via specially named files checked
into the repository.
In this commit, we introduce a new experimental feature for
reading revset aliases from a .hgrevsets file in the working
directory. A repository can then add this file to define
custom revset aliases which will automagically be made available
to anyone who clones the repo and has a modern enough Mercurial
client [with the feature enabled].
Essentially, the .hgrevsets file is parsed as a [revsetalias]
config section but with lower priority than all config files.
This is because a user may want to overwrite an alias defined in
the repo and since not all users can commit to the repo, config
files or --config must take precedence.
One can imagine applying this pattern of "define customizations in
.hg<thing> files" to other features. For example, repositories could
also define templates - either keywords or full template maps.
Another potential area is filesets. You could create named
collections of files and do things like hg files mycollection
or even reference those named collections as part of building a
narrow clone or sparse checkout profile.
While I'm reasonably confident in the implementation, the feature
is marked as experimental because it is close to freeze and this
feature feels a bit dangerous to enable by default with minimal
time to bake.
Is this version check necessary practically? For example, without the minversion check, defining P=X where X is only available in a new version. Old client will get X undefined. With the minversion check, old client will get P undefined. I think X undefined or P undefined is not that much different.
revset could also be defined by extensions. People can also polyfill old mercurial so they have new revsets. It seems to be a lot of work if we also detect extension enabled and their versions.