Skip to content

Commit

Permalink
feat: Preserve tilde when bumping
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Feb 12, 2023
1 parent 52118f5 commit b346042
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/poetry_plugin_up/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,15 @@ def handle_dependency(
self.line(f"No new version for '{dependency.name}'")
return

new_version = "^" + candidate.pretty_version
if (
dependency.pretty_constraint[0] == "~"
and "." in dependency.pretty_constraint
):
new_version = "~" + candidate.pretty_version
else:
new_version = "^" + candidate.pretty_version
if not latest:
if dependency.pretty_constraint[0] == "~":
new_version = "~" + candidate.pretty_version
elif dependency.pretty_constraint[:2] == ">=":
if dependency.pretty_constraint[:2] == ">=":
new_version = ">=" + candidate.pretty_version

self.bump_version_in_pyproject_content(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ waldo = {git = "https://example.com/test/project.git"}
[tool.poetry.group.dev.dependencies]
fred = "1.1.1"
plugh = "^2.2.2"
xyzzy = "^2.2.2"
xyzzy = "~2.2.2"
nacho = "^2.2.2"
thud = "^2.2.2"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ waldo = {git = "https://example.com/test/project.git"}
[tool.poetry.group.dev.dependencies]
fred = "^2.2.2"
plugh = "^2.2.2"
xyzzy = "^2.2.2"
xyzzy = "~2.2.2"
nacho = "^2.2.2"
thud = "^2.2.2"

Expand Down

0 comments on commit b346042

Please sign in to comment.