Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: detach from local filesystem #24

Merged
merged 1 commit into from
Dec 28, 2021
Merged

fs: detach from local filesystem #24

merged 1 commit into from
Dec 28, 2021

Conversation

efiop
Copy link
Contributor

@efiop efiop commented Dec 28, 2021

This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.

This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
if detail:
yield (
root,
{d: self.info(os.path.join(root, d)) for d in dirs},
{f: self.info(os.path.join(root, f)) for f in files},
{d: self.info(posixpath.join(root, d)) for d in dirs},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the record: Will switch to fs.path once it is introduced to fsspec.

Comment on lines 60 to 64
def _get_key(self, path: str) -> Tuple[str, ...]:
from scmrepo.utils import relpath

if os.path.isabs(path):
path = relpath(path, self.root_dir)
relparts = path.split(os.sep)
relparts = path.split(self.sep)
if relparts == ["."]:
return ()
return tuple(relparts)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will introduce _strip_protocol later.

@efiop efiop merged commit 29d8341 into iterative:main Dec 28, 2021
skshetry added a commit that referenced this pull request Mar 7, 2022
skshetry added a commit that referenced this pull request Mar 7, 2022
skshetry added a commit that referenced this pull request Mar 7, 2022
skshetry pushed a commit that referenced this pull request Mar 7, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
skshetry pushed a commit that referenced this pull request Mar 7, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
skshetry pushed a commit that referenced this pull request Mar 19, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
skshetry pushed a commit that referenced this pull request Apr 6, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
efiop added a commit to efiop/scmrepo that referenced this pull request Apr 7, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
efiop added a commit to efiop/scmrepo that referenced this pull request Apr 28, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
efiop added a commit to efiop/scmrepo that referenced this pull request May 2, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
efiop added a commit that referenced this pull request May 2, 2022
This PR makes our fs accept paths relative to the root of the repo and using / as a separator.
Previous behaviour was a legacy from old dvc.

Pre-requisite for making dvcfs/repofs/etc switch to the same relative repo paths and / separators.
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.

1 participant