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

exp save: use -m for --message short option #10005

Merged
merged 1 commit into from
Oct 9, 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
2 changes: 1 addition & 1 deletion dvc/commands/experiments/exec_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def add_parser(experiments_subparsers, parent_parser):
),
)
exec_run_parser.add_argument(
"-M",
"-m",
Copy link
Contributor

@efiop efiop Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should've added aliases=["-M"] to be graceful (though considering that there was a mismatch in docs maybe this hasn't been used all that much anyway yet) I'll add it in a separate PR.

#10006

"--message",
type=str,
default=None,
Expand Down
2 changes: 1 addition & 1 deletion dvc/commands/experiments/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def add_parser(experiments_subparsers, parent_parser):
metavar="<path>",
)
save_parser.add_argument(
"-M",
"-m",
"--message",
type=str,
default=None,
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/command/test_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,24 @@ def test_experiments_save(dvc, scm, mocker):
)


def test_experiments_save_message(dvc, scm, mocker):
cli_args = parse_args(["exp", "save", "-m", "custom commit message"])
assert cli_args.func == CmdExperimentsSave

cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.experiments.save.save", return_value="acabb")

assert cmd.run() == 0

m.assert_called_once_with(
cmd.repo,
name=None,
force=False,
include_untracked=[],
message="custom commit message",
)


def test_experiments_clean(dvc, scm, mocker):
cli_args = parse_args(["experiments", "clean"])
assert cli_args.func == CmdExperimentsClean
Expand Down