You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to introduce a new argument --skip-regex for similar purposes as the current --skip argument which just skips files.
I would be happy to make a contribution if this feature is of interest to you, let me know what you think
Use-case
I have a template and generated projects that have their dependencies automatically updated by renovate (similar to dependabot) and I want to keep the version updating responsibility with renovate and not through running cruft update.
As it currently stands, the template's dependencies are updated quite frequently by renovate which has the effect of failing the generated project's pipeline just as frequently; this is a problem because the generated projects do not care and will never apply these version updates in the template since they use renovate for this.
Since dependencies are stored in pyproject.toml which is used for various other configurations, I cannot just ignore the entire file. So, I would like to ignore only certain changes when updating using the template, hence the proposed use of regex.
In my scenario, I could then run cruft update with --skip-regex='"[^~]?((0|[1-9])\d*)(\.(0|[1-9])\d*)*.*"' which will filter out changes lines that contain strings like "^1.2.3".
Proposal
Add a new --skip-regex parameter in .cruft.json which does not apply changes that match the regex when running cruft update.
Implementation
I would modify the get_diff method to accept a skip_regex parameter, which would be used somewhat like so: git diff | grep -E "<skip_regex>" --invert-match
(this is just an example, I would modify the code & methods appropriately)
The outcome here is that all changes matching the regex are excluded from the diff (modifications, additions & removals) which I think matches the expectations users will have when using this parameter.
For my particular use-case this means that version modifications are correctly ignored, however dependencies added or removed from the template will not be correctly applied to the generated project. This is unfortunate because I would like to have those changes, but I can live with that -- I don't see another solution.
Note that I also investigated some other approaches such as using git diff -S --pickaxe-regex or grepdiff, however these commands look for lines matching a regex in entire patches (afaik). This means that a change like this:
I would like to introduce a new argument
--skip-regex
for similar purposes as the current--skip
argument which just skips files.I would be happy to make a contribution if this feature is of interest to you, let me know what you think
Use-case
I have a template and generated projects that have their dependencies automatically updated by renovate (similar to dependabot) and I want to keep the version updating responsibility with renovate and not through running
cruft update
.As it currently stands, the template's dependencies are updated quite frequently by renovate which has the effect of failing the generated project's pipeline just as frequently; this is a problem because the generated projects do not care and will never apply these version updates in the template since they use renovate for this.
Since dependencies are stored in
pyproject.toml
which is used for various other configurations, I cannot just ignore the entire file. So, I would like to ignore only certain changes when updating using the template, hence the proposed use of regex.In my scenario, I could then run cruft update with
--skip-regex='"[^~]?((0|[1-9])\d*)(\.(0|[1-9])\d*)*.*"'
which will filter out changes lines that contain strings like"^1.2.3"
.Proposal
Add a new
--skip-regex
parameter in.cruft.json
which does not apply changes that match the regex when runningcruft update
.Implementation
I would modify the get_diff method to accept a
skip_regex
parameter, which would be used somewhat like so:git diff | grep -E "<skip_regex>" --invert-match
(this is just an example, I would modify the code & methods appropriately)
The outcome here is that all changes matching the regex are excluded from the diff (modifications, additions & removals) which I think matches the expectations users will have when using this parameter.
For my particular use-case this means that version modifications are correctly ignored, however dependencies added or removed from the template will not be correctly applied to the generated project. This is unfortunate because I would like to have those changes, but I can live with that -- I don't see another solution.
Note that I also investigated some other approaches such as using
git diff -S --pickaxe-regex
orgrepdiff
, however these commands look for lines matching a regex in entirepatches
(afaik). This means that a change like this:Would be grouped in a patch and collectively ignored since one of those lines matches my version regex, which is not what we want.
Looking forward to knowing about your thoughts on this 🙂
The text was updated successfully, but these errors were encountered: