-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
--force
not allowed during dvc move
#7240
Comments
Sample test case. The move used to overwrite before 256cb06 def test_move_file_exists(tmp_dir, dvc):
from dvc.exceptions import OverlappingOutputPathsError
tmp_dir.dvc_gen({"foo": "foo", "bar": "bar"})
dvc.move("foo", "bar")
assert (tmp_dir / "bar").read_text() == "foo"
assert (tmp_dir / "bar.dvc").exists()
assert not (tmp_dir / "foo").exists()
assert not (tmp_dir / "foo.dvc").exists()
|
A simpler fix would be to pass Edit : diff --git a/dvc/repo/move.py b/dvc/repo/move.py
index a4f1a7c1..c2dcbf4c 100644
--- a/dvc/repo/move.py
+++ b/dvc/repo/move.py
@@ -67,6 +67,7 @@ def move(self, from_path, to_path):
wdir=new_wdir,
outs=[to_path],
meta=stage.meta,
+ force=True
)
os.unlink(stage.path) |
Adding support for |
Thanks for the clarification @pmrowla . The hint seems to be tightly coupled to the validation function. The hint makes sense for single/pipeline stages created with run as suggested in #4003. Perhaps an additional flag being passed to check_stage_exists like |
I don't think we need an extra flag, the hint in Lines 293 to 301 in 92f714e
cc: @skshetry |
Bug Report
Description
--force
is required to overwrite a file during move, but this isn't allowed as a parameterReproduce
a
andb
, checking both into dvcdvc move a b
produces the errorUse '--force' to overwrite.
dvc move --force a b
produces the errorERROR: unrecognized arguments: --force
Expected
force
should allow overwritingEnvironment information
Output of
dvc doctor
:The text was updated successfully, but these errors were encountered: