Skip to content

Commit

Permalink
Merge pull request #101 from callowayproject/93-incorrectly-bumps-dep…
Browse files Browse the repository at this point in the history
…endency-that-matches-project-version

Refactored configuration file updating.
  • Loading branch information
coordt authored Dec 6, 2023
2 parents 51526bf + cae12dc commit ca75de5
Show file tree
Hide file tree
Showing 27 changed files with 1,062 additions and 623 deletions.
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: ["pydantic<2.0", "toml", "types-all"]
additional_dependencies: ["pydantic>2.0", "toml", "types-all"]
- repo: https://github.com/jsh9/pydoclint
rev: 0.3.8
hooks:
Expand All @@ -59,3 +59,5 @@ repos:
rev: 0.27.1
hooks:
- id: check-azure-pipelines
ci:
autofix_prs: false
8 changes: 6 additions & 2 deletions bumpversion/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from bumpversion.files import ConfiguredFile
from bumpversion.version_part import Version

from bumpversion.config import Config, update_config_file
from bumpversion.config import Config
from bumpversion.config.files import update_config_file, update_ini_config_file
from bumpversion.exceptions import ConfigurationError
from bumpversion.utils import get_context, key_val_string

Expand Down Expand Up @@ -81,7 +82,10 @@ def do_bump(

configured_files = resolve_file_config(config.files_to_modify, config.version_config)
modify_files(configured_files, version, next_version, ctx, dry_run)
update_config_file(config_file, config.current_version, next_version_str, dry_run)
if config_file and config_file.suffix in {".cfg", ".ini"}:
update_ini_config_file(config_file, config.current_version, next_version_str, dry_run)
else:
update_config_file(config_file, config, version, next_version, ctx, dry_run)

ctx = get_context(config, version, next_version)
ctx["new_version"] = next_version_str
Expand Down
6 changes: 3 additions & 3 deletions bumpversion/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from bumpversion import __version__
from bumpversion.aliases import AliasedGroup
from bumpversion.bump import do_bump
from bumpversion.config import find_config_file, get_configuration
from bumpversion.config import get_configuration
from bumpversion.config.files import find_config_file
from bumpversion.files import ConfiguredFile, modify_files
from bumpversion.logging import setup_logging
from bumpversion.show import do_show, log_list
from bumpversion.ui import print_warning
from bumpversion.ui import print_warning, setup_logging
from bumpversion.utils import get_context, get_overrides

logger = logging.getLogger(__name__)
Expand Down
Loading

0 comments on commit ca75de5

Please sign in to comment.