Repository navigation
Create Drive directories in mkdir and makedirs - #409
shcheklein wants to merge 11 commits into
Conversation
shcheklein
left a comment
There was a problem hiding this comment.
AI-generated review of ae0d8572fbc4e3b35707c9ad19616388aa9b21b8.
Scope is well-bounded for #349, and the request-level + live tests are concise. Main findings inline: walking top-down from root misses self.base / cached ancestors (adding extra Drive calls for nested mounts like dvc-gdrive), relying on _get_cached_item_ids right after _get_remote_item_ids as a folder-vs-file side-channel will race once #408 lands, and not base makes an uncached self.info() call on every root-level makedirs(..., exist_ok=True).
shcheklein
left a comment
There was a problem hiding this comment.
AI-generated re-review of adb4a5cac8b6fb2611e927855fbbb622b9618bc7 (from scratch).
The bottom-up ancestor walk (missing), direct _named_items folder filtering (removing the cache side-channel), and _mount_directory_ids() filtering are all much cleaner and resolve the earlier issues.
Two remaining things flagged inline: an unlocked read/write race on self._directory_ids / root_cache["root_is_directory"], and duplication between root_is_directory here and _root_location in #411.
|
Directory creation now uses the path resolver from #408. It handles named mounts, exact-case matches and multiple folder IDs once. The request tests still require one lookup and one create per missing folder, zero requests for an already cached folder, and one lookup when a file blocks creation at a named mount. This PR continues to target #408. |
Fixes #349. This PR builds on #408.
PyDrive2 inherited fsspec's no-op directory creation methods.
mkdirandmakedirsnow create real Drive folders and use the resolver from #408 to identify missing components, existing folders, and blocking files. Bare folder-ID mounts also check their Drive, MIME type and trash status.Tests cover
create_parents,exist_ok, duplicate names, shared drives and concurrent invalidation. They require one lookup and one create per missing component and zero requests for an already cached directory. A live Drive test verifies an empty nested directory from a fresh filesystem instance.