git: improve error message in case a file lock could not be acquired while cloning a repo#10535
Merged
radoering merged 1 commit intopython-poetry:mainfrom Sep 10, 2025
Merged
Conversation
…while cloning a repo
Reviewer's GuideEnhances the Git backend to handle file lock acquisition failures during cloning by introducing a specific error constant, extending exception handling with tailored messages, refactoring problem-section constants for clarity, and adding tests to validate the new behavior. Sequence diagram for handling file lock acquisition failure during Git clonesequenceDiagram
participant GitBackend
participant LocalRepo
participant FileLock
participant PoetryRuntimeError
GitBackend->>LocalRepo: import_refs()
LocalRepo->>FileLock: acquire()
FileLock-->>LocalRepo: throws FileLocked
LocalRepo-->>GitBackend: raises FileLocked
GitBackend->>PoetryRuntimeError: create(reason, info)
PoetryRuntimeError-->>GitBackend: raises error with detailed message
Class diagram for updated error handling in Git backendclassDiagram
class GitBackend {
+_clone_legacy(url, refspec, target)
+_clone(url, refspec, target)
}
class PoetryRuntimeError {
+create(reason, info, exception=None)
}
class FileLocked {
+filename: bytes
+lockfilename: bytes
}
GitBackend --> PoetryRuntimeError : raises
LocalRepo --> FileLocked : may raise
GitBackend ..> FileLocked : handles exception
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Extract the inline to_str helper to a module-level function so it can be reused and the exception block stays concise.
- Consider merging the two PROBLEMS_SECTION_START constants into a single parameterized template (e.g. injecting specific issue types) to reduce duplication and confusion.
- Double-check whether the file-lock error should consistently use the NETWORK_ISSUES section start or a dedicated one to keep message formatting uniform.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Extract the inline to_str helper to a module-level function so it can be reused and the exception block stays concise.
- Consider merging the two PROBLEMS_SECTION_START constants into a single parameterized template (e.g. injecting specific issue types) to reduce duplication and confusion.
- Double-check whether the file-lock error should consistently use the NETWORK_ISSUES section start or a dedicated one to keep message formatting uniform.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This was referenced Sep 7, 2025
jelmer
approved these changes
Sep 7, 2025
Contributor
|
As dulwich upstream, looks good to me - but I'm not a poetry committer. |
mwalbeck
pushed a commit
to mwalbeck/docker-python-poetry
that referenced
this pull request
Sep 26, 2025
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [poetry](https://github.com/python-poetry/poetry) ([changelog](https://python-poetry.org/history/)) | minor | `2.1.4` -> `2.2.1` | --- ### Release Notes <details> <summary>python-poetry/poetry (poetry)</summary> ### [`v2.2.1`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#221---2025-09-21) [Compare Source](python-poetry/poetry@2.2.0...2.2.1) ##### Fixed - Fix an issue where `poetry self show` failed with a message about an invalid output format ([#​10560](python-poetry/poetry#10560)). ##### Docs - Remove outdated statements about dependency groups ([#​10561](python-poetry/poetry#10561)). ##### poetry-core ([`2.2.1`](https://github.com/python-poetry/poetry-core/releases/tag/2.2.1)) - Fix an issue where it was not possible to declare a PEP 735 dependency group as optional ([#​888](python-poetry/poetry-core#888)). ### [`v2.2.0`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#220---2025-09-14) [Compare Source](python-poetry/poetry@2.1.4...2.2.0) ##### Added - **Add support for nesting dependency groups** ([#​10166](python-poetry/poetry#10166)). - **Add support for PEP 735 dependency groups** ([#​10130](python-poetry/poetry#10130)). - **Add support for PEP 639 license clarity** ([#​10413](python-poetry/poetry#10413)). - Add a `--format` option to `poetry show` to alternatively output json format ([#​10487](python-poetry/poetry#10487)). - Add official support for Python 3.14 ([#​10514](python-poetry/poetry#10514)). ##### Changed - **Normalize dependency group names** ([#​10387](python-poetry/poetry#10387)). - Change `installer.no-binary` and `installer.only-binary` so that explicit package names will take precedence over `:all:` ([#​10278](python-poetry/poetry#10278)). - Improve log output during `poetry install` when a wheel is built from source ([#​10404](python-poetry/poetry#10404)). - Improve error message in case a file lock could not be acquired while cloning a git repository ([#​10535](python-poetry/poetry#10535)). - Require `dulwich>=0.24.0` ([#​10492](python-poetry/poetry#10492)). - Allow `virtualenv>=20.33` again ([#​10506](python-poetry/poetry#10506)). - Allow `findpython>=0.7` ([#​10510](python-poetry/poetry#10510)). - Allow `importlib-metadata>=8.7` ([#​10511](python-poetry/poetry#10511)). ##### Fixed - Fix an issue where `poetry new` did not create the project structure in an existing empty directory ([#​10431](python-poetry/poetry#10431)). - Fix an issue where a dependency that was required for a specific Python version was not installed into an environment of a pre-release Python version ([#​10516](python-poetry/poetry#10516)). ##### poetry-core ([`2.2.0`](https://github.com/python-poetry/poetry-core/releases/tag/2.2.0)) - Deprecate table values and values that are not valid SPDX expressions for `[project.license]` ([#​870](python-poetry/poetry-core#870)). - Fix an issue where explicitly included files that are in `.gitignore` were not included in the distribution ([#​874](python-poetry/poetry-core#874)). - Fix an issue where marker operations could result in invalid markers ([#​875](python-poetry/poetry-core#875)). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS42MC40IiwidXBkYXRlZEluVmVyIjoiNDEuNjAuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.walbeck.it/walbeck-it/docker-python-poetry/pulls/1588 Co-authored-by: renovate-bot <[email protected]> Co-committed-by: renovate-bot <[email protected]>
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Check List
Resolves: #7832
Short error message:
Failed to clone <repo_url> at <ref>, unable to acquire file lock for <path>.Verbose error message:
Summary by Sourcery
Improve Git clone error handling by catching file lock acquisition failures, providing a clear short message and an extended troubleshooting note, refining related message constants, and adding a test for locked refs.
New Features:
Enhancements:
Tests: