pyfilesystem2
pyfilesystem2 copied to clipboard
Fix file move time preservation (#558)
Type of changes
- Bug fix
Checklist
- [x] I've run the latest black with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [ ] I've updated the Documentation.
- [x] I accept that @PyFilesystem/maintainers may be pedantic in the code review.
Description
This PR fixes a bug in the methods FS.move and MemoryFS.move, where preserve_time=True resulted in an ResourceNotFound error (see #558).
The new functions to separate copy.copy_modified_time are currently residing in copy.py. One could argue that reading and updating a files meta info are more suitable for info.py, but this would introduce further changes. Additionally, we could modify the original one to utilize both new functions. This would avoid code duplication but introduce further function calls. Opinions on this matter and reviews are welcomed!
Lastly, I would update the documentation for the new functions accordingly.
@lurch, any thoughts on this draft? :)
Ping