mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Merge pull request #2485 from pared/2477
move: use relpath to find target path
This commit is contained in:
+3
-3
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user