Skip to content
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

Not require to rewrite full cfg-file when bumping the version #163

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

balrok
Copy link
Contributor

@balrok balrok commented Oct 4, 2020

Since pr #90 introduced a lot of breaking changes (can bee seen in the updated unit tests in #162 ). Here is another approach. Basically it makes it opt-in to use bump2version on the .bumpversion.cfg rather than the opt-out approach of #90.

When this PR is merged it solves #87, #62, and provides a solution for #161

@balrok
Copy link
Contributor Author

balrok commented Nov 13, 2020

What do you think? It is not breaking existing tools while having finally a way to write comments into the cfg-file.
This is especially important if the file is used to configure other tools too.

@yakky
Copy link

yakky commented Nov 16, 2020

@balrok If I understand correctly your patch will avoid bump2version to update the config file, and one has to rely on the explicit configuration which will only update the version string via _replace_version_in_files instead of _update_config_file which rewrites the whole configuration file
This looks a smart move.
The only concern is that it's not 100% compatible as one has to change its configuration to retain the current behavior (even for people not affected by the current behavior)

@florisla florisla self-requested a review January 8, 2021 16:28
csadorf added a commit to aiidalab/repo2env that referenced this pull request May 12, 2021
Place configuration in .bumpversion.cfg to avoid re-write of setup.cfg.
See also: c4urself/bump2version#163
jccurtis pushed a commit to lbl-anp/becquerel that referenced this pull request Oct 5, 2021
… rewriting the setup.cfg during version bumps which cause pre-commit to fail. See:

* c4urself/bump2version#90
* c4urself/bump2version#163
albireox and others added 3 commits February 19, 2022 12:47
changing the default behavior of bump2version to always use the
search/replace functionality to update the version in the cfg-files,
brings several backwards incompatible changes:

    1. when current_version did not exist in .bumpversion.cfg, it will not be updated
     - when retrieving the version from the git tag
     - when retrieving the version via --current_version flag
    2. when .bumpversion.cfg contains a "new_version" field, previously this
      field was removed, but with this change it is not possible anymore

To get the desired functionality, we keep the current behavior.
But now, if the config-file is explicitely specified to be handled by bump2version search/replace, it is not rewritten.

The reason, why someone wants this is, that the old behavior of
rewriting the .cfg file discards all comments and custom formatting.
@simonmoesorensen
Copy link

I know it's not great to revive dead threads, but is this PR going to get merged in the future? My team is having issues with pre-commit and bump2version as in #124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants