Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dvc/repo/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def move(self, from_path, to_path):
os.path.join(os.curdir, os.path.dirname(to_path))
)

to_out = Output.loads_from(
stage, [os.path.basename(to_path)], out.use_cache, out.metric
)[0]
to_path = os.path.relpath(to_path, stage.wdir)

to_out = Output.loads_from(stage, [to_path], out.use_cache, out.metric)[0]

with self.state:
out.move(to_out)
Expand Down
10 changes: 10 additions & 0 deletions tests/func/test_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,13 @@ def test_move_should_save_stage_info(dvc_repo, repo_dir):
dvc_repo.move(repo_dir.DATA_DIR, "new_name")

assert dvc_repo.status() == {}


def test_should_move_to_dir_on_non_default_stage_file(dvc_repo, repo_dir):
stage_file_name = "stage.dvc"

dvc_repo.add(repo_dir.FOO, fname=stage_file_name)

dvc_repo.move(repo_dir.FOO, repo_dir.DATA_DIR)

assert os.path.exists(os.path.join(repo_dir.DATA_DIR, repo_dir.FOO))