-
Notifications
You must be signed in to change notification settings - Fork 132
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
search-replace falls back to plain version lookup in some cases #198
Comments
I agree, the use of Not sure if we can use The alternative is to use |
You're right, Come to think of it, have you considered just using |
Additionally, if you'd use |
bumpversion.utils.contains
is used as a guard to ensure that when the search pattern is not found,bump2version
will not fall back to the default (as mentioned in the README). However, due to inconsistent matching behavior betweenbumpversion.utils.contains
andbumpversion.utils.replace
, in some cases it does fall back.An example:
Suppose
version.txt
contains the following (note the leading spaces):An attempt at a
bumpversion.cfg
file to match this:1.0.0
and leaves the other one alone or this fails with an error message.1.0.0
with the entire replace string, resulting in the following:The cause is that
bumpversion.utils.contains
usesin
to check whether the first and last lines match, whilebumpversion.utils.replace
usesstr.replace
. The former matches even if the last line has leading characters not in the search line or if the first line has trailing characters not in the search line. I believe this is incorrect. This method should use== lookbehind[0].lstrip()
and== lookbehind[-1].rstrip()
instead ofin lookbehind[0]
and similar.The text was updated successfully, but these errors were encountered: