Skip to content
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

add: deprecate --file #9547

Merged
merged 1 commit into from
Jun 6, 2023
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: 0 additions & 6 deletions dvc/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def run(self):
self.repo.add(
self.args.targets,
no_commit=self.args.no_commit,
file=self.args.file,
external=self.args.external,
glob=self.args.glob,
out=self.args.out,
Expand Down Expand Up @@ -62,11 +61,6 @@ def add_parser(subparsers, parent_parser):
default=False,
help="Allows targets containing shell-style wildcards.",
)
parser.add_argument(
"--file",
help="Specify name of the .dvc file this command will generate.",
metavar="<filename>",
)
parser.add_argument(
"-o",
"--out",
Expand Down
22 changes: 0 additions & 22 deletions tests/func/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,28 +450,6 @@ def test_add_force_overwrite_out(caplog, tmp_dir, dvc):
assert (tmp_dir / "foo").read_text() == "foo"


def test_add_filename(tmp_dir, dvc):
tmp_dir.gen({"foo": "foo", "bar": "bar", "data": {"file": "file"}})
ret = main(["add", "foo", "bar", "--file", "error.dvc"])
assert ret != 0

ret = main(["add", "data", "--file", "data_directory.dvc"])
assert ret == 0
assert (tmp_dir / "data_directory.dvc").exists()

ret = main(["add", "foo", "--file", "bar.dvc"])
assert ret == 0
assert (tmp_dir / "bar.dvc").exists()
assert not (tmp_dir / "foo.dvc").exists()

(tmp_dir / "bar.dvc").unlink()

ret = main(["add", "foo", "--file", "bar.dvc"])
assert ret == 0
assert (tmp_dir / "bar.dvc").exists()
assert not (tmp_dir / "foo.dvc").exists()


def test_failed_add_cleanup(tmp_dir, scm, dvc):
tmp_dir.gen({"foo": "foo", "bar": "bar"})

Expand Down
4 changes: 0 additions & 4 deletions tests/unit/command/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ def test_add(mocker, dvc):
"--no-commit",
"--external",
"--glob",
"--file",
"file",
"data",
]
)
Expand All @@ -27,7 +25,6 @@ def test_add(mocker, dvc):
["data"],
no_commit=True,
glob=True,
file="file",
external=True,
out=None,
remote=None,
Expand Down Expand Up @@ -60,7 +57,6 @@ def test_add_to_remote(mocker):
["s3://bucket/foo"],
no_commit=False,
glob=False,
file=None,
external=False,
out="bar",
remote="remote",
Expand Down