Skip to content
/ dvc Public
forked from iterative/dvc

Commit

Permalink
add/run/import-url: don't use -f as --file (iterative#4004)
Browse files Browse the repository at this point in the history
If anything, `-f` is closer to `--force` than to `--file`. So let's set
this straight.
  • Loading branch information
efiop authored Jun 10, 2020
1 parent afe539a commit 91a7194
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 21 deletions.
1 change: 0 additions & 1 deletion dvc/command/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def add_parser(subparsers, parent_parser):
help="Allow targets that are outside of the DVC repository.",
)
parser.add_argument(
"-f",
"--file",
help="Specify name of the DVC-file this command will generate.",
metavar="<filename>",
Expand Down
1 change: 0 additions & 1 deletion dvc/command/imp_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def add_parser(subparsers, parent_parser):
"out", nargs="?", help="Destination path to put files to."
)
import_parser.add_argument(
"-f",
"--file",
help="Specify name of the DVC-file this command will generate.",
metavar="<filename>",
Expand Down
1 change: 0 additions & 1 deletion dvc/command/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def add_parser(subparsers, parent_parser):
metavar="<path>",
)
run_parser.add_argument(
"-f",
"--file",
help="Specify name of the DVC-file this command will generate.",
metavar="<filename>",
Expand Down
8 changes: 4 additions & 4 deletions tests/func/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,20 +449,20 @@ def test(self):

class TestAddFilename(TestDvc):
def test(self):
ret = main(["add", self.FOO, self.BAR, "-f", "error.dvc"])
ret = main(["add", self.FOO, self.BAR, "--file", "error.dvc"])
self.assertNotEqual(0, ret)

ret = main(["add", "-R", self.DATA_DIR, "-f", "error.dvc"])
ret = main(["add", "-R", self.DATA_DIR, "--file", "error.dvc"])
self.assertNotEqual(0, ret)

with self.assertRaises(RecursiveAddingWhileUsingFilename):
self.dvc.add(self.DATA_DIR, recursive=True, fname="error.dvc")

ret = main(["add", self.DATA_DIR, "-f", "data_directory.dvc"])
ret = main(["add", self.DATA_DIR, "--file", "data_directory.dvc"])
self.assertEqual(0, ret)
self.assertTrue(os.path.exists("data_directory.dvc"))

ret = main(["add", self.FOO, "-f", "bar.dvc"])
ret = main(["add", self.FOO, "--file", "bar.dvc"])
self.assertEqual(0, ret)
self.assertTrue(os.path.exists("bar.dvc"))
self.assertFalse(os.path.exists("foo.dvc"))
Expand Down
2 changes: 0 additions & 2 deletions tests/func/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ def test(self):
out_no_cache1,
"--outs-no-cache",
out_no_cache2,
"-f",
fname,
"--file",
fname,
cmd,
Expand Down
6 changes: 0 additions & 6 deletions tests/func/test_import_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ def setUp(self):
fobj.write("content")

def test(self):
ret = main(["import-url", "-f", "bar.dvc", self.external_source])
self.assertEqual(0, ret)
self.assertTrue(os.path.exists("bar.dvc"))

os.remove("bar.dvc")

ret = main(["import-url", "--file", "bar.dvc", self.external_source])
self.assertEqual(0, ret)
self.assertTrue(os.path.exists("bar.dvc"))
Expand Down
4 changes: 2 additions & 2 deletions tests/func/test_repro.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def test(self):
"run",
"--no-exec",
"--single-stage",
"-f",
"--file",
DVC_FILE,
*deps,
"ls {}".format(
Expand Down Expand Up @@ -818,7 +818,7 @@ def test(self):
[
"run",
"--single-stage",
"-f",
"--file",
f"{dname}/Dvcfile",
"-w",
f"{dname}",
Expand Down
8 changes: 4 additions & 4 deletions tests/func/test_run_single_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def test(self):
self.CODE,
"-o",
"out",
"-f",
"--file",
"out.dvc",
"--single-stage",
"python",
Expand All @@ -528,7 +528,7 @@ def test(self):
self.CODE,
"-o",
"out",
"-f",
"--file",
"out.dvc",
"--single-stage",
"python",
Expand Down Expand Up @@ -557,7 +557,7 @@ def test(self):
"--single-stage",
"-o",
"out",
"-f",
"--file",
"out.dvc",
"python",
self.CODE,
Expand All @@ -578,7 +578,7 @@ def test(self):
"run",
"--overwrite",
"--single-stage",
"-f",
"--file",
"out.dvc",
"-d",
self.BAR,
Expand Down

0 comments on commit 91a7194

Please sign in to comment.