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

When search is not found, only fall back to original_version if search is not customized #128

Merged
merged 5 commits into from
Feb 20, 2020

Conversation

florisla
Copy link
Collaborator

Closes #127

This allows downstream users (calling main() as a library) to catch
a single exception type.
Before, this was an AssertionError but that's no good either -- assert() can be
disabled in Python (-O flag) and that would kill this functionality altogether.
@florisla
Copy link
Collaborator Author

florisla commented Jan 27, 2020

I've tried removing the fallback to original_version altogether, but that fails some cases.

The scenario is:

  • a custom serialize pattern introduces extra (new) data into the serialized version string, e.g. from an $ENV_VARIABLE.
  • as a result, the serialized version string is not currently present in the source file, but the original current_version string is.
  • without falling back to original_version, the replacement can not occur.

Current tests which exposed this are test_bump_version_environment, test_distance_to_latest_tag_as_part_of_a_new_version, test_multi_file_configuration2.

I think this current approach is an improvement nonetheless. It will prevent the incorrect operation shown in #127 and still supports current usage.

@ekohl ekohl merged commit 648036b into c4urself:master Feb 20, 2020
@ekohl
Copy link
Collaborator

ekohl commented Feb 20, 2020

Looks like a good improvement, thanks!

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

Successfully merging this pull request may close these issues.

Don't fall back to original_version if search pattern is not found
2 participants