Repository navigation
Conversation
Expire the oldest backup before shifting filenames so the newly rotated last generation is retained, including the keep=1 boundary. Tested: 678 tests and doctests; real-file rotation with keep=1 Confidence: high Scope-risk: narrow
Owner
|
Folded into #610 (see the PR description for credit). Thanks for the report and the repro. |
blebo
pushed a commit
to blebo/boltons
that referenced
this pull request
Nov 1, 2026
…oud#483) Workstream-Session-Id: 01a1743e-7af6-7000-999f-e3695b3279ef Workstream-Plan-Id: 2026-10-25-7167a83d96
blebo
pushed a commit
to blebo/boltons
that referenced
this pull request
Nov 1, 2026
…hmoud#608 to 26.3.0 Workstream-Session-Id: 01a1743e-7af6-7000-999f-e3695b3279ef Workstream-Plan-Id: 2026-10-25-7167a83d96
This was referenced Nov 13, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
rotate_file(path, keep=1)currently deletes the backup it just created, leaving no copy of the file. For larger values it retainskeep - 1generations instead of the requested count.Remove the oldest generation before the descending rename sequence. This lets the new last generation survive. Update the two full-rotation tests to verify all five retained contents (including replacement of a pre-existing fifth backup), and add repeated-rotation tests for
keep=1,2, and5, with and without extensions.Fixes #479.
Validation:
keep=1leaves an empty directory.python -m pytest --doctest-modules boltons tests -q).keep=0is rejected.This branch is independent of #482. AI assistance was used for implementation and tests; before/after filesystem behavior was verified locally.