diff --git a/dvc/commands/imp.py b/dvc/commands/imp.py index 215d78f44..34021a552 100644 --- a/dvc/commands/imp.py +++ b/dvc/commands/imp.py @@ -18,7 +18,6 @@ class CmdImport(CmdBase): self.args.url, self.args.path, out=self.args.out, - fname=self.args.file, rev=self.args.rev, no_exec=self.args.no_exec, no_download=self.args.no_download, @@ -69,11 +68,6 @@ def add_parser(subparsers, parent_parser): help="Git revision (e.g. SHA, branch, tag)", metavar="", ) - import_parser.add_argument( - "--file", - help="Specify name of the .dvc file this command will generate.", - metavar="", - ) no_download_exec_group = import_parser.add_mutually_exclusive_group() no_download_exec_group.add_argument( "--no-exec", diff --git a/dvc/commands/imp_url.py b/dvc/commands/imp_url.py index 118948bb2..21d826c57 100644 --- a/dvc/commands/imp_url.py +++ b/dvc/commands/imp_url.py @@ -15,7 +15,6 @@ class CmdImportUrl(CmdBase): self.repo.imp_url( self.args.url, out=self.args.out, - fname=self.args.file, no_exec=self.args.no_exec, no_download=self.args.no_download, remote=self.args.remote, @@ -64,11 +63,6 @@ def add_parser(subparsers, parent_parser): import_parser.add_argument( "out", nargs="?", help="Destination path to put files to." ).complete = completion.DIR - import_parser.add_argument( - "--file", - help="Specify name of the .dvc file this command will generate.", - metavar="", - ).complete = completion.DIR import_parser.add_argument( "--to-remote", action="store_true", diff --git a/dvc/repo/imp.py b/dvc/repo/imp.py index 14454c1aa..0bdf9d8eb 100644 --- a/dvc/repo/imp.py +++ b/dvc/repo/imp.py @@ -1,6 +1,6 @@ -def imp(self, url, path, out=None, fname=None, rev=None, **kwargs): +def imp(self, url, path, out=None, rev=None, **kwargs): erepo = {"url": url} if rev is not None: erepo["rev"] = rev - return self.imp_url(path, out=out, fname=fname, erepo=erepo, frozen=True, **kwargs) + return self.imp_url(path, out=out, erepo=erepo, frozen=True, **kwargs) diff --git a/dvc/repo/imp_url.py b/dvc/repo/imp_url.py index 330d840b0..4deb8ad9c 100644 --- a/dvc/repo/imp_url.py +++ b/dvc/repo/imp_url.py @@ -18,7 +18,6 @@ def imp_url( # noqa: C901, PLR0913 self: "Repo", url, out=None, - fname=None, erepo=None, frozen=True, no_download=False, @@ -58,7 +57,7 @@ def imp_url( # noqa: C901, PLR0913 stage = self.stage.create( single_stage=True, validate=False, - fname=fname or path, + fname=path, wdir=wdir, deps=[url], outs=[out], diff --git a/tests/func/test_import_url.py b/tests/func/test_import_url.py index 4d129ef49..f2fe89c8d 100644 --- a/tests/func/test_import_url.py +++ b/tests/func/test_import_url.py @@ -63,22 +63,6 @@ def test_import_conflict_and_override(tmp_dir, dvc): assert os.path.exists("bar.dvc") -def test_import_filename(tmp_dir, dvc, cloud): - external_source = cloud / "file" - (cloud / "file").write_text("content", encoding="utf-8") - ret = main(["import-url", "--file", "bar.dvc", external_source.fs_path]) - assert ret == 0 - assert (tmp_dir / "bar.dvc").exists() - - (tmp_dir / "bar.dvc").unlink() - (tmp_dir / "sub").mkdir() - - path = tmp_dir / "sub" / "bar.dvc" - ret = main(["import-url", "--file", path.fs_path, external_source.fs_path, "out"]) - assert ret == 0 - assert path.exists() - - @pytest.mark.parametrize("dname", [".", "dir", "dir/subdir"]) def test_import_url_to_dir(dname, tmp_dir, dvc): tmp_dir.gen({"data_dir": {"file": "file content"}}) diff --git a/tests/unit/command/test_imp.py b/tests/unit/command/test_imp.py index 17cbb2d11..81228f955 100644 --- a/tests/unit/command/test_imp.py +++ b/tests/unit/command/test_imp.py @@ -10,8 +10,6 @@ def test_import(mocker): "src", "--out", "out", - "--file", - "file", "--rev", "version", "--jobs", @@ -29,7 +27,6 @@ def test_import(mocker): "repo_url", path="src", out="out", - fname="file", rev="version", no_exec=False, no_download=False, @@ -45,8 +42,6 @@ def test_import_no_exec(mocker): "src", "--out", "out", - "--file", - "file", "--rev", "version", "--no-exec", @@ -62,7 +57,6 @@ def test_import_no_exec(mocker): "repo_url", path="src", out="out", - fname="file", rev="version", no_exec=True, no_download=False, @@ -78,8 +72,6 @@ def test_import_no_download(mocker): "src", "--out", "out", - "--file", - "file", "--rev", "version", "--no-download", @@ -95,7 +87,6 @@ def test_import_no_download(mocker): "repo_url", path="src", out="out", - fname="file", rev="version", no_exec=False, no_download=True, diff --git a/tests/unit/command/test_imp_url.py b/tests/unit/command/test_imp_url.py index 92598b250..7bea5c39f 100644 --- a/tests/unit/command/test_imp_url.py +++ b/tests/unit/command/test_imp_url.py @@ -13,8 +13,6 @@ def test_import_url(mocker): "import-url", "src", "out", - "--file", - "file", "--jobs", "4", ] @@ -29,7 +27,6 @@ def test_import_url(mocker): m.assert_called_once_with( "src", out="out", - fname="file", no_exec=False, no_download=False, remote=None, @@ -70,8 +67,6 @@ def test_import_url_no_exec_download_flags(mocker, flag, expected): flag, "src", "out", - "--file", - "file", ] ) @@ -83,7 +78,6 @@ def test_import_url_no_exec_download_flags(mocker, flag, expected): m.assert_called_once_with( "src", out="out", - fname="file", remote=None, to_remote=False, jobs=None, @@ -114,7 +108,6 @@ def test_import_url_to_remote(mocker): m.assert_called_once_with( "s3://bucket/foo", out="bar", - fname=None, no_exec=False, no_download=False, remote="remote",