Repository: iterative/dvc

Issue:
experiments: show table includes all staged/stashed experiments instead of only the currently applicable ones
```
example-get-started git:executor-tree  py:dvc ❯ dvc exp show --no-pager --include-params=featurize
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ Experiment                         ┃     auc ┃ featurize.max_features ┃ featurize.ngrams ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ workspace                          │ 0.54175 │ 500                    │ 5                │
│ bbdfa81 (2020-08-21 11:27:38)      │ 0.54175 │ 500                    │ 5                │
│ ├── ebbf40d (2020-08-21 11:28:42)  │ 0.50822 │ 1500                   │ 4                │
│ └── *32c3875 (2020-08-21 12:05:16) │       - │ 1500                   │ 7                │
│ ├── *8cb834d (2020-08-21 12:04:59) │       - │ 1500                   │ 2                │
│ ├── *32d107b (2020-08-21 12:05:01) │       - │ 1500                   │ 5                │
│ └── *4f2c53c (2020-08-21 12:05:04) │       - │ 1500                   │ 6                │
└────────────────────────────────────┴─────────┴────────────────────────┴──────────────────┘
```

the last 3 stashed experiments are derived from a different baseline commit and should be excluded by default (unless `--all-commit`/etc are used)


Discussion:

Resolving patch:
diff --git a/dvc/repo/experiments/show.py b/dvc/repo/experiments/show.py
--- a/dvc/repo/experiments/show.py
+++ b/dvc/repo/experiments/show.py
@@ -73,10 +73,11 @@ def show(
 
     # collect queued (not yet reproduced) experiments
     for stash_rev, (_, baseline_rev) in repo.experiments.stash_revs.items():
-        with repo.experiments.chdir():
-            experiment = _collect_experiment(
-                repo.experiments.exp_dvc, stash_rev, stash=True
-            )
-        res[baseline_rev][stash_rev] = experiment
+        if baseline_rev in revs:
+            with repo.experiments.chdir():
+                experiment = _collect_experiment(
+                    repo.experiments.exp_dvc, stash_rev, stash=True
+                )
+            res[baseline_rev][stash_rev] = experiment
 
     return res


Test patch:
diff --git a/tests/func/experiments/test_show.py b/tests/func/experiments/test_show.py
--- a/tests/func/experiments/test_show.py
+++ b/tests/func/experiments/test_show.py
@@ -60,3 +60,45 @@ def test_show_experiment(tmp_dir, scm, dvc):
         else:
             assert exp["metrics"]["metrics.yaml"] == expected_params
             assert exp["params"]["params.yaml"] == expected_params
+
+
+def test_show_queued(tmp_dir, scm, dvc):
+    tmp_dir.gen("copy.py", COPY_SCRIPT)
+    tmp_dir.gen("params.yaml", "foo: 1")
+    stage = dvc.run(
+        cmd="python copy.py params.yaml metrics.yaml",
+        metrics_no_cache=["metrics.yaml"],
+        params=["foo"],
+        name="foo",
+    )
+    scm.add(["copy.py", "params.yaml", "metrics.yaml", "dvc.yaml", "dvc.lock"])
+    scm.commit("baseline")
+    baseline_rev = scm.get_rev()
+
+    dvc.reproduce(
+        stage.addressing, experiment=True, params=["foo=2"], queue=True
+    )
+    exp_rev = dvc.experiments.scm.resolve_rev("stash@{0}")
+
+    results = dvc.experiments.show()[baseline_rev]
+    assert len(results) == 2
+    exp = results[exp_rev]
+    assert exp["queued"]
+    assert exp["params"]["params.yaml"] == {"foo": 2}
+
+    # test that only queued experiments for the current baseline are returned
+    tmp_dir.gen("foo", "foo")
+    scm.add(["foo"])
+    scm.commit("new commit")
+    new_rev = scm.get_rev()
+
+    dvc.reproduce(
+        stage.addressing, experiment=True, params=["foo=3"], queue=True
+    )
+    exp_rev = dvc.experiments.scm.resolve_rev("stash@{0}")
+
+    results = dvc.experiments.show()[new_rev]
+    assert len(results) == 2
+    exp = results[exp_rev]
+    assert exp["queued"]
+    assert exp["params"]["params.yaml"] == {"foo": 3}