PICARD-2496: Add option to skip moving files if destination already exists#3093
PICARD-2496: Add option to skip moving files if destination already exists#3093iron-prog wants to merge 8 commits intometabrainz:masterfrom
Conversation
rdswift
left a comment
There was a problem hiding this comment.
I haven't reviewed this in great depth to try to understand whether it is actually necessary or if this is the best solution. If it is necessary and appropriate, the documentation will absolutely need to be updated to explain the new configuration setting, but I see that you have indicated that there are no documentation changes required.
I may be wrong, but I suspect that the AI Usage in developing this PR is actually higher than you indicated.
|
For clarity for the users, perhaps there could be (mutually exclusive) radio buttons for the three options:
That way the preference could be stored in a single setting, rather than multiple binary settings relying on code to maintain their mutual exclusivity. |
|
thanks for this suggestion it's my bad for relying on ai |
Yes, I think it would be clearer. |
… (skip/rename/overwrite)
cc658cb to
aaea73a
Compare
picard/file.py
Outdated
| config = get_config() | ||
| strategy = config.setting.get('move_conflict_strategy', 'rename') | ||
| if os.path.exists(new_filename): | ||
| if strategy == "skip": | ||
| log.warning("Destination exists, skipping move of %r", old_filename) | ||
| return old_filename | ||
| elif strategy == "rename": | ||
| new_filename = get_available_filename(new_filename, old_filename) | ||
| elif strategy == "overwrite": | ||
| pass |
There was a problem hiding this comment.
This will get "rename" as the value if there is no 'move_conflict_strategy' setting, but will actually process as "overwrite" if there is a value other than "skip", "rename" or "overwrite".
Also, this code is repeated below in the _apply_additional_file_moves() method below. You might want to consider making this a separate helper method called from the other methods.
77145b1 to
1243977
Compare
|
@rdswift Thanks for the detailed review! |
1243977 to
ed395db
Compare
|
Please provide meaningful descriptions for your commits. The commit message "ruff fail" on everything does not provide any useful information as to what reviewers can expect to see when they review the commit. Also, please don't continually force push each time. That destroys the revision history for the PR and causes the reviewers to have to go through all of the changes each time, rather than what has changed incrementally since their last review (causing much more work for the reviewers and making them less likely to review and accept the PR). I suggest that you review the following best practices and consider incorporating them into your workflow: |
|
there is some problem going on authentication in GitHub in my terminal like I have one previous git account which I deleted and second which I m working right now but some times it's just does not give access(or switch randomly although no sign it is in my terminal or workflow) due to which I have to force push after many changes I have tried many ways to fix it because of this I use force push and for commit message I use what I changes but sometimes in hurry or simple failure I message this |
|
In that case, I suggest that you get this sorted out and working properly before continuing to make any PR submissions. I plan to avoid any further reviews until this has been addressed. |
|
Thanks for pointing this out, and apologies for the workflow issues. |
…s with move_conflict_strategy and add config migration
|
Please DO NOT keep using the same commit message for everything. The commit message should indicate what has changed in that commit. Also, you requested my review again, but you still haven't addressed all of my previous comments. |
|
Thanks for the review I was busy with my sem examination so it's my mistake I m going to address all concerns now with precision and as you suggested. |
…d UI support and fix reviewer feedback
Summary
This PR introduces a new option allowing Picard to skip moving files if the destination file already exists.
New option:
"Skip moving files if destination already exists"
Location:
Options → File Naming → Move files when saving
Behavior priority:
Adds a new configuration option allowing Picard to skip moving files if a file with the same name already exists in the destination directory.
Problem
When moving files during tagging, Picard currently either renames the file by adding a numbered suffix (e.g.,
(1)) or overwrites the existing file depending on user settings.Some users prefer to leave the file untouched if a file with the same name already exists in the destination directory.
Solution
This PR introduces a new setting
move_skip_existing_files.If enabled, Picard checks whether the destination file already exists before moving a file.
If it does exist, the move operation is skipped and the file remains in its original location.
Implementation details:
BoolOption(move_skip_existing_files) inoptions.pypicard/file.pyto skip the move when the option is enabledDefault behavior remains unchanged if the option is disabled.
AI Usage
In accordance with the AI use policy portion of the MetaBrainz Contribution Guidelines, the level of AI/LLM use in the development of this Pull Request is:
Action
Additional actions required: