Skip to content

Commit

Permalink
fix windows path handling
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored and daavoo committed Dec 1, 2022
1 parent 28402de commit d57bb23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 10 additions & 5 deletions dvc/repo/metrics/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
from dvc.repo import locked
from dvc.repo.collect import StrPaths, collect
from dvc.scm import NoSCMError
from dvc.utils import error_handler, errored_revisions, onerror_collect
from dvc.utils import (
as_posix,
error_handler,
errored_revisions,
onerror_collect,
)
from dvc.utils.collections import ensure_list
from dvc.utils.serialize import load_path

Expand All @@ -31,12 +36,12 @@ def _to_fs_paths(metrics: List[Output]) -> StrPaths:
def _collect_top_level_metrics(repo):
top_metrics = repo.index._top_metrics # pylint: disable=protected-access
for dvcfile, metrics in top_metrics.items():
wdir = repo.dvcfs.path.relpath(
repo.dvcfs.path.parent(dvcfile), repo.root_dir
wdir = repo.fs.path.relpath(
repo.fs.path.parent(dvcfile), repo.root_dir
)
for file in metrics:
path = repo.dvcfs.path.join(wdir, file)
yield repo.dvcfs.path.normpath(path)
path = repo.fs.path.join(wdir, as_posix(file))
yield repo.fs.path.normpath(path)


def _collect_metrics(repo, targets, revision, recursive):
Expand Down
15 changes: 10 additions & 5 deletions dvc/repo/params/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
from dvc.scm import NoSCMError
from dvc.stage import PipelineStage
from dvc.ui import ui
from dvc.utils import error_handler, errored_revisions, onerror_collect
from dvc.utils import (
as_posix,
error_handler,
errored_revisions,
onerror_collect,
)
from dvc.utils.collections import ensure_list
from dvc.utils.serialize import load_path

Expand All @@ -38,12 +43,12 @@ def _is_params(dep: "Output"):
def _collect_top_level_params(repo):
top_params = repo.index._top_params # pylint: disable=protected-access
for dvcfile, params in top_params.items():
wdir = repo.dvcfs.path.relpath(
repo.dvcfs.path.parent(dvcfile), repo.root_dir
wdir = repo.fs.path.relpath(
repo.fs.path.parent(dvcfile), repo.root_dir
)
for file in params:
path = repo.dvcfs.path.join(wdir, file)
yield repo.dvcfs.path.normpath(path)
path = repo.fs.path.join(wdir, as_posix(file))
yield repo.fs.path.normpath(path)


def _collect_configs(
Expand Down

0 comments on commit d57bb23

Please sign in to comment.