From 7b3089443ebe704867cf90f95c2ddd86a9c7a84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Fri, 4 Oct 2019 23:46:23 -0700 Subject: [PATCH 1/2] Add config file to list of files to bump --- bumpversion/cli.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bumpversion/cli.py b/bumpversion/cli.py index 5a7d5317..3247b73a 100644 --- a/bumpversion/cli.py +++ b/bumpversion/cli.py @@ -104,14 +104,18 @@ def main(original_args=None): for file_name in (file_names or positionals[1:]) ) + + if config_file_exists and config_file not in files: + files.extend([ConfiguredFile(config_file, version_config)]) + _check_files_contain_version(files, current_version, context) _replace_version_in_files(files, current_version, new_version, args.dry_run, context) _log_list(config, args.new_version) # store the new version - _update_config_file( - config, config_file, config_newlines, config_file_exists, args.new_version, args.dry_run, - ) + # _update_config_file( + # config, config_file, config_newlines, config_file_exists, args.new_version, args.dry_run, + # ) # commit and tag if vcs: From 94244855ea0408f28c4932146949da6a294585c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Sat, 5 Oct 2019 00:02:17 -0700 Subject: [PATCH 2/2] Call _update_config_file but only write if file does not exist --- bumpversion/cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bumpversion/cli.py b/bumpversion/cli.py index 3247b73a..49688433 100644 --- a/bumpversion/cli.py +++ b/bumpversion/cli.py @@ -113,9 +113,9 @@ def main(original_args=None): _log_list(config, args.new_version) # store the new version - # _update_config_file( - # config, config_file, config_newlines, config_file_exists, args.new_version, args.dry_run, - # ) + _update_config_file( + config, config_file, config_newlines, config_file_exists, args.new_version, args.dry_run, + ) # commit and tag if vcs: @@ -610,7 +610,7 @@ def _update_config_file( config.set("bumpversion", "current_version", new_version) new_config = StringIO() try: - write_to_config_file = (not dry_run) and config_file_exists + write_to_config_file = (not dry_run) and not config_file_exists logger.info( "%s to config file %s:",