Skip to content

Commit

Permalink
ls: specify rev as kwarg (#6121)
Browse files Browse the repository at this point in the history
Fixes #5865
  • Loading branch information
efiop authored Jun 7, 2021
1 parent 2f8cf8d commit 8b9b2f6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dvc/repo/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def ls(url, path=None, rev=None, recursive=None, dvc_only=False):
"""
from . import Repo

with Repo.open(url, rev, subrepos=True, uninitialized=True) as repo:
with Repo.open(url, rev=rev, subrepos=True, uninitialized=True) as repo:
path_info = PathInfo(repo.root_dir)
if path:
path_info /= path
Expand Down
18 changes: 18 additions & 0 deletions tests/func/test_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,24 @@ def test_ls_repo_with_removed_dvc_dir_with_path_file(tmp_dir, dvc, scm):
match_files(files, ((("file",), True),))


def test_ls_repo_with_rev(erepo_dir):
with erepo_dir.chdir():
erepo_dir.scm_gen(FS_STRUCTURE, commit="init")
erepo_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")

rev = erepo_dir.scm.list_all_commits()[1]
files = Repo.ls(os.fspath(erepo_dir), rev=rev)
match_files(
files,
(
((".dvcignore",), False),
((".gitignore",), False),
(("README.md",), False),
(("model",), False),
),
)


def test_ls_remote_repo(erepo_dir):
with erepo_dir.chdir():
erepo_dir.scm_gen(FS_STRUCTURE, commit="init")
Expand Down

0 comments on commit 8b9b2f6

Please sign in to comment.