From bd8b1ae559c029f15c40a77546c7e2cb2a3aa95a Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Mon, 13 Mar 2023 16:06:59 +0200 Subject: [PATCH] exp: push/pull: don't include baseline commit Fixes #6592 --- dvc/repo/experiments/utils.py | 2 -- tests/func/test_gc.py | 8 +------- tests/unit/scm/test_scm.py | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/dvc/repo/experiments/utils.py b/dvc/repo/experiments/utils.py index e9db9428ef..8a3a17437f 100644 --- a/dvc/repo/experiments/utils.py +++ b/dvc/repo/experiments/utils.py @@ -215,8 +215,6 @@ def exp_commits( refs = ref_infos if ref_infos else exp_refs(scm) for ref_info in refs: shas.update(scm.branch_revs(str(ref_info), ref_info.baseline_sha)) - if ref_info.baseline_sha: - shas.add(ref_info.baseline_sha) yield from shas diff --git a/tests/func/test_gc.py b/tests/func/test_gc.py index a1c71d0fb0..50c504fee3 100644 --- a/tests/func/test_gc.py +++ b/tests/func/test_gc.py @@ -276,8 +276,7 @@ def test_gc_all_experiments(tmp_dir, scm, dvc): (foo,) = tmp_dir.dvc_gen("foo", "foo", commit="foo") foo_hash = foo.outs[0].hash_info.value - (bar,) = tmp_dir.dvc_gen("foo", "bar", commit="bar") - bar_hash = bar.outs[0].hash_info.value + tmp_dir.dvc_gen("foo", "bar", commit="bar") baseline = scm.get_rev() (baz,) = tmp_dir.dvc_gen("foo", "baz", commit="baz") @@ -288,12 +287,7 @@ def test_gc_all_experiments(tmp_dir, scm, dvc): dvc.gc(all_experiments=True, force=True) - # all_experiments will include the experiment commit (baz) plus baseline - # commit (bar) assert not (tmp_dir / ".dvc" / "cache" / foo_hash[:2] / foo_hash[2:]).exists() - assert ( - tmp_dir / ".dvc" / "cache" / bar_hash[:2] / bar_hash[2:] - ).read_text() == "bar" assert ( tmp_dir / ".dvc" / "cache" / baz_hash[:2] / baz_hash[2:] ).read_text() == "baz" diff --git a/tests/unit/scm/test_scm.py b/tests/unit/scm/test_scm.py index 2820d406a7..99a5886c3e 100644 --- a/tests/unit/scm/test_scm.py +++ b/tests/unit/scm/test_scm.py @@ -64,7 +64,6 @@ def test_iter_revs( assert gen == { rev_new: [rev_new], rev_old: [rev_old], - rev_root: [rev_root], } def _resolve_commit(rev):