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

Output messages are sometimes misleading #112 #172

Merged
merged 4 commits into from
Dec 6, 2023

Conversation

Rulrn
Copy link
Contributor

@Rulrn Rulrn commented Dec 5, 2023

Don't run changes if nothing to change

fixes #112

Solution

Check if old_string == new_string for ChangeRequest before adding to the change requests.

Tests

With the following template:

[version]
current = "6.11.0"
regex = '''
  (?P<major>\d+)
  \.
  (?P<minor>\d+)
  \.
  (?P<patch>\d+)
  (\-
    (?P<extra>.+)
  )?
  '''

...

[[file]]
src = "tbump/cli.py"
version_template = "{major}.{minor}.{patch}"

run the command python -m tbump 6.11.0-1 --dry

Previous output

:: Bumping from 6.11.0 to 6.11.0-1
=> Would update current version in tbump.toml
- tbump.toml:6 current = "6.11.0"
+ tbump.toml:6 current = "6.11.0-1"
=> Would patch these files
- pyproject.toml:6 version = "6.11.0"
+ pyproject.toml:6 version = "6.11.0-1"
- tbump/cli.py:21 TBUMP_VERSION = "6.11.0"
+ tbump/cli.py:21 TBUMP_VERSION = "6.11.0"
=> Would run these hooks before commit
* (1/2) $ poetry run invoke lint && poetry run pytest
* (2/2) $ grep -q 6.11.0-1 Changelog.rst
=> Would run these git commands
$ git add --update
$ git commit --message Bump to 6.11.0-1
$ git tag --annotate --message v6.11.0-1 v6.11.0-1
$ git push --atomic   v6.11.0-1
=> Would run these hooks after push
* (1/1) $ poetry publish --build

New output

:: Bumping from 6.11.0 to 6.11.0-1
=> Would update current version in tbump.toml
- tbump.toml:6 current = "6.11.0"
+ tbump.toml:6 current = "6.11.0-1"
=> Would patch these files
- pyproject.toml:6 version = "6.11.0"
+ pyproject.toml:6 version = "6.11.0-1"
=> Would run these hooks before commit
* (1/2) $ poetry run invoke lint && poetry run pytest
* (2/2) $ grep -q 6.11.0-1 Changelog.rst
=> Would run these git commands
$ git add --update
$ git commit --message Bump to 6.11.0-1
$ git tag --annotate --message v6.11.0-1 v6.11.0-1
$ git push --atomic   v6.11.0-1
=> Would run these hooks after push
* (1/1) $ poetry publish --build

@Rulrn Rulrn changed the title Issue 112 Output messages are sometimes misleading #112 Dec 5, 2023
@dmerejkowsky
Copy link
Collaborator

Thanks for the fix !

@dmerejkowsky dmerejkowsky merged commit 77f143f into your-tools:main Dec 6, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output messages are sometimes misleading
2 participants