-
Notifications
You must be signed in to change notification settings - Fork 461
Reuse InitCatalog's guts in UpdateCatalog #1244
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1244 +/- ##
==========================================
- Coverage 92.07% 92.06% -0.01%
==========================================
Files 27 27
Lines 4692 4688 -4
==========================================
- Hits 4320 4316 -4
Misses 372 372
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the catalog initialization logic to fix a bug where pybabel update --init-missing would fail if the target directory didn't exist. The refactoring extracts the catalog initialization code into a shared _init_catalog function that both InitCatalog and UpdateCatalog can use, ensuring consistent behavior including automatic directory creation.
Key changes:
- Introduced a new
_init_cataloghelper function that encapsulates catalog initialization logic and directory creation - Refactored
InitCatalogandUpdateCatalogcommands to use the shared function - Added test coverage for directory creation with
--init-missingflag
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| babel/messages/frontend.py | Extracted catalog initialization into _init_catalog function; updated InitCatalog and UpdateCatalog to use shared function with directory creation |
| tests/messages/frontend/test_cli.py | Added test to verify that pybabel update --init-missing creates parent directories when they don't exist |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #1139 (since `_init_catalog` creates directories on the way) Co-authored-by: lando <du33169@qq.com>
9826fc5 to
ff8071e
Compare
Fixes #1139 (since
_init_catalogcreates directories on the way)Closes #1142 (supersedes it)