Skip to content

Conversation

@skshetry
Copy link
Collaborator

@skshetry skshetry commented Feb 5, 2024

Comment on lines +372 to +374
dvc_info = dvc_fs.info(dvc_path)
if dvc_info["type"] == "file":
dvc_infos[""] = dvc_info
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since fs.ls() is now expected to return result even if it's a file, we are keeping it in a special "" (root) key so that we can return result for the file easily.

Later, we check if the type of the path matches in both fs.info() and dvc_fs.info().
If they mismatch (eg: when a path data is tracked as a file in dvc, but is now a directory in the workspace or vice versa), we invalidate dvc_fs.info() and then return fs.info().
This is the behaviour that we have in the tests.

Comment on lines +86 to +88
if fs.isfile(fs_path):
infos[os.path.basename(path)] = fs.info(fs_path)
else:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have switched the if-else here, since fs.walk() also returns result for files now.


if not dvc_info and not fs_info:
raise FileNotFoundError
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to improve error message as we now log the message for dvc ls.

I had to do that because you'd see an unexpected error in case of FileNotFoundErrror.

@shcheklein shcheklein mentioned this pull request Feb 5, 2024
2 tasks
@skshetry skshetry marked this pull request as ready for review February 6, 2024 01:16
@skshetry skshetry requested a review from a team February 6, 2024 01:17
@codecov
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (2bf7bd9) 90.43% compared to head (27a0649) 90.42%.
Report is 1 commits behind head on main.

Files Patch % Lines
dvc/commands/ls/__init__.py 0.00% 2 Missing and 1 partial ⚠️
dvc/fs/callbacks.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10280      +/-   ##
==========================================
- Coverage   90.43%   90.42%   -0.01%     
==========================================
  Files         494      494              
  Lines       37782    37775       -7     
  Branches     5463     5467       +4     
==========================================
- Hits        34167    34157      -10     
- Misses       2984     2985       +1     
- Partials      631      633       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@efiop efiop merged commit d25cb79 into treeverse:main Feb 6, 2024
@skshetry skshetry deleted the dvc-objects-v4 branch February 6, 2024 08:50
BradyJ27 pushed a commit to BradyJ27/dvc that referenced this pull request Apr 22, 2024
* deps: bump dvc-objects, dvc-data and scmrepo

* bump dvc-azure

* fix typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants