-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
189 conditional search and replace blocks #197
Conversation
Updated the configuration file model to support valid_bumps and invalid_bumps. This feature provides control over which version section updates can trigger file changes. Adjusted various test fixtures and cleaned up tests to match these changes. Also, some updates were made to the documentation accordingly.
Several new file types have been added to .gitignore for ignoring during commits. These include '.python-version', 'requirements-dev.lock', and 'requirements.lock' files.
This commit introduces the ability to filter files based on whether the specified bump type is valid or not. It adds `valid_bumps` and `invalid_bumps` lists in the file configurations and adjusts the bumping process to consider these configurations. Tests are updated to reflect these new handling of valid and invalid bumps.
Version hint: minor Comment ID: Display the version hint-auto-generated |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #197 +/- ##
==========================================
+ Coverage 93.73% 93.77% +0.03%
==========================================
Files 25 25
Lines 1549 1557 +8
Branches 306 309 +3
==========================================
+ Hits 1452 1460 +8
Misses 70 70
Partials 27 27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
docs/reference/configuration.md
Outdated
@@ -722,6 +723,40 @@ If `True`, don't fail if the version string to be replaced is not found in the f | |||
|
|||
if `True`, don't fail if the configured file is missing. | |||
|
|||
### valid_bumps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's more clear to name these options include_bumps
and exclude_bumps
? Or (dis)allow, (de)select?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great observation. Naming things is hard. I like include/exclude
docs/reference/configuration.md
Outdated
type | ||
: list of strings | ||
|
||
The `invalid_bumps` file configuration allows you to control when this file is changed by exclusion. When a `bump <version component>` command is issued, this file is only changed if the version component is *not in this list.* The [parse](#parse) configuration defines version components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to explicitly state that this option can't be used together with valid_bumps
. Unless you want to support regex inputs, I don't see how both options can be combined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are always combined because the included bumps are always defined. Declaring both of them doesn't make much sense, but it works. I'll try and adjust the docs accordingly.
bumpversion/config/models.py
Outdated
@@ -120,6 +122,8 @@ def add_files(self, filename: Union[str, List[str]]) -> None: | |||
regex=self.regex, | |||
ignore_missing_version=self.ignore_missing_version, | |||
ignore_missing_file=self.ignore_missing_files, | |||
valid_bumps=tuple(self.parts.keys()), | |||
invalid_bumps=(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is invalid_bumps
included as empty tuple here - is it just the DEFAULT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for invalid_bumps
is None
. But after consideration, I will add a default_factory
to that field.
bumpversion/config/utils.py
Outdated
@@ -22,6 +22,8 @@ def get_all_file_configs(config_dict: dict) -> List[FileChange]: | |||
"ignore_missing_version": config_dict["ignore_missing_version"], | |||
"ignore_missing_file": config_dict["ignore_missing_files"], | |||
"regex": config_dict["regex"], | |||
"valid_bumps": tuple(config_dict["parts"]), | |||
"invalid_bumps": (), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, same here, is invalid_bumps
implemented? :-)
Co-authored-by: wkoot <[email protected]>
…umps The configuration parameters `valid_bumps` and `invalid_bumps` were renamed to `include_bumps` and `exclude_bumps` respectively. This new naming better denotes their function, and the changes were consistently applied across all related files and tests. Numerous fixture outputs were also updated to reflect these changes.
docs/reference/configuration.md
Outdated
|
||
The default value, or an empty list, includes all version components. | ||
The default value, or an empty list, includes all version components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value, or an empty list, includes all version components. | |
The default value, or an empty list, includes all version components. |
docs/reference/configuration.md
Outdated
|
||
type | ||
: list of strings | ||
|
||
The `valid_bumps` file configuration allows you to control when this file is changed. When a `bump <version component>` command is issued, this file is changed only if the version component is in this list and not in [`invalid_bumps`](#invalid_bumps). The [parse](#parse) configuration defines version components. | ||
The `include_bumps` file configuration allows you to control when this file is changed by inclusion. Its alternative is the `exclude_bumps` configuration. When a `bump <version component>` command is issued, this file is changed only if the version component is in this list and not in [`exclude_bumps`](#exclude_bumps). The [parse](#parse) configuration defines version components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "inverse" instead of "alternative" ?
This appears to be working on my end! Thanks so much! |
The changes made update the wording in the documentation to clarify the roles of `include_bumps` and `exclude_bumps` in the bump-my-version configuration. Additionally, unnecessary repetition was removed and overlapping examples were also corrected.
Add
valid_bumps
andinvalid_bumps
to file configuration.Updated the configuration file model to support
valid_bumps
andinvalid_bumps
configurations. This feature provides control over which version section updates can trigger file changes. Adjusted various test fixtures and cleaned up tests to match these changes. Also, some updates were made to the documentation accordingly.Add file filtering based on
valid_bumps
andinvalid bumps
.This commit introduces the ability to filter files based on whether the specified bump type is valid. It adds
valid_bumps
andinvalid_bumps
lists in the file configurations and adjusts the bumping process to consider these configurations. Tests have been updated to reflect the new handling of valid and invalid bumps.