exp show: add --rev flag (#7152)

fix: #7152
1. Add `--rev` flag to `dvc exp show`.
2. Add -1 support for `--num` flag`.
3. Extract revision found logic to `utils`.
4. Brancher use this revision found logic.
5. Update command unit test
6. Add a util unit test.

Co-authored-by: Peter Rowlands (변기호) <[email protected]>
This commit is contained in:
karajan1001
2022-01-11 19:01:34 +08:00
committed by Gao
co-authored by Peter Rowlands
parent 87abeaddc2
commit b673ac24d0
7 changed files with 171 additions and 68 deletions
+2 -1
View File
@@ -351,8 +351,9 @@ def test_show_multiple_commits(tmp_dir, scm, dvc, exp_stage):
tmp_dir.scm_gen("file", "file", "commit")
next_rev = scm.get_rev()
dvc.experiments.show(num=-1)
with pytest.raises(InvalidArgumentError):
dvc.experiments.show(num=-1)
dvc.experiments.show(num=-2)
expected = {"workspace", init_rev, next_rev}
results = dvc.experiments.show(num=2)