fix: workspace member with fixed version
Description
Fix 2 things with cargo provider :
- use same order to get / set a version for package or workspace
- there is no
workspace.version = "0.1.0"in spec to fix the version of a specific workspace member. It must beversion = "0.1.0", even if it is a workspace member
Checklist
- [x] I have read the contributing guidelines
Code Changes
- [x] Add test cases to all the changes you introduce
- [x] Run
poetry alllocally to ensure this change passes linter check and tests - [x] Manually test the changes:
- [x] Verify the feature/bug fix works as expected in real-world scenarios
- [x] Test edge cases and error conditions
- [x] Ensure backward compatibility is maintained
- [x] Document any manual testing steps performed
- [x] Update the documentation for the changes
Documentation Changes
- [x] Run
poetry doclocally to ensure the documentation pages renders correctly - [x] Check and fix any broken links (internal or external) in the documentation
When running
poetry doc, any broken internal documentation links will be reported in the console output like this:INFO - Doc file 'config.md' contains a link 'commands/bump.md#-post_bump_hooks', but the doc 'commands/bump.md' does not contain an anchor '#-post_bump_hooks'.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 98.75%. Comparing base (120d514) to head (a1048a6).
:warning: Report is 881 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1715 +/- ##
==========================================
+ Coverage 97.33% 98.75% +1.41%
==========================================
Files 42 60 +18
Lines 2104 2655 +551
==========================================
+ Hits 2048 2622 +574
+ Misses 56 33 -23
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 98.75% <100.00%> (+1.41%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Hi @vemilano ,
We are planning to merge the branch v4-10-1, which contains changes in cargo_provider.py, into master branch.
You can resolve the potential conflict on this PR after we release 4.10.1.
cc @Lee-W
nit: you have typo in your commit message
I reviewed the commit in 4.10.1 and it should fix both issues. However, it changes one behavior: if there are both a workspace and a root package, it will bump the version of the workspace, and not the root package.
This might be unwanted behavior, as if there is a root package, this is probably the main project the author is working on.
We may want to get the version of the root package first (if it exists), and fallback on the version of the workspace.
What do you think of it @bearomorphism ?
Actually, I am not familiar with cargo files.
@Lee-W wdyt? Which behavior do you think is correct?
Hi @vemilano could you rebase? The current cargo_provider is quite different as of now. However, the behavior is the same. workspace is evaluated first. This has been done for simplicity and lack of "opinions" (we test workspace, and on failure we check project root). I usually either have a root version, or a shared workspace version, so it hasn't been an issue for me. Could you elaborate on why updating the root version first makes sense when they differ? thanks
For rebasing:
git remote add upstream https://github.com/commitizen-tools/commitizen.git
git fetch upstream
git rebase upstream/master
# fix conflicts
git add commitizen/providers/cargo_provider.py
git rebase --continue
git push origin fix/cargo-workspace-version -f