import: drop --file (#9562)

This commit is contained in:
Dave Berenbaum
2023-06-09 10:03:32 +05:45
committed by GitHub
parent ed664143b4
commit 528eab0418
7 changed files with 3 additions and 48 deletions
-6
View File
@@ -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="<commit>",
)
import_parser.add_argument(
"--file",
help="Specify name of the .dvc file this command will generate.",
metavar="<filename>",
)
no_download_exec_group = import_parser.add_mutually_exclusive_group()
no_download_exec_group.add_argument(
"--no-exec",
-6
View File
@@ -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="<filename>",
).complete = completion.DIR
import_parser.add_argument(
"--to-remote",
action="store_true",
+2 -2
View File
@@ -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)
+1 -2
View File
@@ -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],
-16
View File
@@ -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"}})
-9
View File
@@ -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,
-7
View File
@@ -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",