exp push/pull: add --all-commits flag and unify the collection of revs (#7154)

fix: #7154
1. rename flags `-A/--all-commits` in the `exp pull/push`
2. add new flag "--rev" and "--num" in the `exp pull/push`
3. Unify the collection of revs in `exp push/pull`
4. add unit and func tests for `exp push/pull`
This commit is contained in:
karajan1001
2022-03-09 17:43:26 +08:00
committed by Gao
parent d033345860
commit 244637e299
6 changed files with 270 additions and 68 deletions
+46
View File
@@ -229,6 +229,11 @@ def test_experiments_push(dvc, scm, mocker):
"origin",
"experiment1",
"experiment2",
"--all-commits",
"-n",
"2",
"--rev",
"foo",
"--force",
"--no-cache",
"--remote",
@@ -249,6 +254,9 @@ def test_experiments_push(dvc, scm, mocker):
cmd.repo,
"origin",
["experiment1", "experiment2"],
rev="foo",
all_commits=True,
num=2,
force=True,
push_cache=False,
dvc_remote="my-remote",
@@ -256,6 +264,22 @@ def test_experiments_push(dvc, scm, mocker):
run_cache=True,
)
cli_args = parse_args(
[
"experiments",
"push",
"origin",
]
)
cmd = cli_args.func(cli_args)
with pytest.raises(InvalidArgumentError) as exp_info:
cmd.run()
assert (
str(exp_info.value) == "Either provide an `experiment` argument"
", or use the `--rev` or `--all-commits` flag."
)
def test_experiments_pull(dvc, scm, mocker):
cli_args = parse_args(
@@ -264,6 +288,9 @@ def test_experiments_pull(dvc, scm, mocker):
"pull",
"origin",
"experiment",
"--all-commits",
"--rev",
"foo",
"--force",
"--no-cache",
"--remote",
@@ -284,6 +311,9 @@ def test_experiments_pull(dvc, scm, mocker):
cmd.repo,
"origin",
["experiment"],
rev="foo",
all_commits=True,
num=1,
force=True,
pull_cache=False,
dvc_remote="my-remote",
@@ -291,6 +321,22 @@ def test_experiments_pull(dvc, scm, mocker):
run_cache=True,
)
cli_args = parse_args(
[
"experiments",
"pull",
"origin",
]
)
cmd = cli_args.func(cli_args)
with pytest.raises(InvalidArgumentError) as exp_info:
cmd.run()
assert (
str(exp_info.value) == "Either provide an `experiment` argument"
", or use the `--rev` or `--all-commits` flag."
)
@pytest.mark.parametrize(
"queue,clear_all,remote",