Skip to content

Commit

Permalink
exp: push/pull: don't include baseline commit
Browse files Browse the repository at this point in the history
Fixes #6592
  • Loading branch information
efiop committed Mar 14, 2023
1 parent 54a6709 commit b56f6b6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
2 changes: 0 additions & 2 deletions dvc/repo/experiments/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
8 changes: 1 addition & 7 deletions tests/func/test_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
Expand Down
1 change: 0 additions & 1 deletion tests/unit/scm/test_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b56f6b6

Please sign in to comment.