Add smv_refs_filter_fn
config option
#80
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Regexes are simple and easily transferable, but have limited expressivity. We've found that the regex options cannot express all the restrictions we may want, and even where they can be expressed as a regex they're often restrictive. For instance we want to limit the number of old release tags that we still build the docs for, and we currently do that with a regex which attempts to match a minimum semver value.
It would be more expressive if we could simply pass a function which looks at each gitref and decides if we want to build docs for it. Additionally, this function can sort the gitrefs (so we don't need to try and express the order in a template later), and rewrite the other metadata if required (I was hoping to set an
is_release
bool here, but it turns out that's set later).This adds a new config option which takes a callable to transform (or, I guess, entirely reconstruct!) the retrieved gitrefs. The only non-obvious change is that I had to make
load_sphinx_config
execute in-process for the first call, so that the callable is correctly retained and not lost when the loading process closes. This is a partial reversion of #30, but I believe its safe - the separate process is still used to parse the config for all the other configs, ensuring that they get the correct localconf.py
.