Fix sync for folders synced by earlier versions - #130
Merged
Merged
Conversation
Ignore `.cld-sync` entries whose remote file does not exist. In dynamic folder mode, match remote raw files with local files of the same content that were saved without the extension, e.g. `notes` or `notes (1)`. Delete test assets of all resource types in `delete_cld_folder_if_exists`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
sync deleting raw files synced by earlier versionssync --push deleting files synced by earlier versions
sync --push deleting files synced by earlier versionssync for folders synced by earlier versions
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.
Since #124,
syncadds the extension to the remote name of a raw file in dynamic folder mode (notes→notes.txt). Local folders synced by earlier versions still use the old names, sosync --pushtreated those remote files as unique and deleted them.Use cases fixed
.cld-synchasnotes.txt → notes)notes.txt,notes.csv)notes, no extension)notes (1),notes (2), ...), including after a remote copy was deleted.cld-syncentry that points to a remote file that no longer exists, for images too (e.g.a.png → zzz.pngwhilea.pngis on Cloudinary)a.pngand uploads nothingBrief Summary of Changes
SyncDir._verify_diverse_file_names(cloudinary_cli/modules/sync.py), applied when.cld-syncis read:notes,notes (1), ...), only when the content (etag) is the same.delete_cld_folder_if_exists(test/helper_test.py) deletes test assets of all resource types. It deleted only images before.TestCLISync, dynamic folder mode only. One per row above, except the last, plus one for a new push and pull of a raw file.What does this PR address?
Are tests included?
Reviewer, please note:
.cld-syncentries that point to missing files. When the target is missing, keeping the entry and dropping it give the same result for push and pull.syncworks as onmaster.masterand on this branch, with the same results for images and videos:jpegalias.Checklist:
Ran the sync tests only:
test/test_modules/test_cli_sync.py, 13 existing integration tests, 4 new ones, and 6 offline ones, all passing.🤖 Generated with Claude Code