# Buggy code
def show(
    repo,
    all_branches=False,
    all_tags=False,
    revs=None,
    all_commits=False,
    sha_only=False,
):
    res = defaultdict(OrderedDict)

    if revs is None:
        revs = [repo.scm.get_rev()]

    revs = OrderedDict(
        (rev, None)
        for rev in repo.brancher(
            revs=revs,
            all_branches=all_branches,
            all_tags=all_tags,
            all_commits=all_commits,
        )
    )

    for rev in revs:
        res[rev]["baseline"] = _collect_experiment(repo, rev, sha_only=sha_only)

    # collect reproduced experiments
    for exp_branch in repo.experiments.scm.list_branches():
        m = repo.experiments.BRANCH_RE.match(exp_branch)
        if m:
            rev = repo.scm.resolve_rev(m.group("baseline_rev"))
            if rev in revs:
                exp_rev = repo.experiments.scm.resolve_rev(exp_branch)
                with repo.experiments.chdir():
                    experiment = _collect_experiment(
                        repo.experiments.exp_dvc, exp_branch
                    )
                res[rev][exp_rev] = experiment

    # collect queued (not yet reproduced) experiments
    for stash_rev, entry in repo.experiments.stash_revs.items():
        if entry.baseline_rev in revs:
            with repo.experiments.chdir():
                experiment = _collect_experiment(
                    repo.experiments.exp_dvc, stash_rev, stash=True
                )
            res[entry.baseline_rev][stash_rev] = experiment

    return res


# Traceback (dvc.scm.base.RevError)
dvc exp show -T -v
2020-09-21 17:33:07,541 DEBUG: Check for update is enabled.
2020-09-21 17:33:07,570 DEBUG: fetched: [(3,)]
2020-09-21 17:33:08,049 DEBUG: fetched: [(75,)]
2020-09-21 17:33:08,058 ERROR: failed to show experiments - unknown Git revision 'f97e3cca64d10c299f7e9e54dd22889c6ee7a1b4, decouple/base'
------------------------------------------------------------
Traceback (most recent call last):
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/command/experiments.py", line 258, in run
sha_only=self.args.sha,
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 616, in show
return show(self.repo, *args, **kwargs)
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/__init__.py", line 51, in wrapper
return f(repo, *args, **kwargs)
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/show.py", line 73, in show
repo, rev, sha_only=sha_only
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/experiments/show.py", line 16, in _collect_experiment
for rev in repo.brancher(revs=[branch]):
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/repo/brancher.py", line 49, in brancher
for sha, names in group_by(scm.resolve_rev, revs).items():
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/funcy/seqs.py", line 317, in group_by
result[f(item)].append(item)
File "/home/roman/miniconda3/envs/tensorflow/lib/python3.6/site-packages/dvc/scm/git.py", line 432, in resolve_rev
raise RevError(f"unknown Git revision '{rev}'")
dvc.scm.base.RevError: unknown Git revision 'f97e3cca64d10c299f7e9e54dd22889c6ee7a1b4, decouple/base'

# Fixed code
def show(
    repo,
    all_branches=False,
    all_tags=False,
    revs=None,
    all_commits=False,
    sha_only=False,
):
    res = defaultdict(OrderedDict)

    if revs is None:
        revs = [repo.scm.get_rev()]

    revs = OrderedDict(
        (rev, None)
        for rev in repo.brancher(
            revs=revs,
            all_branches=all_branches,
            all_tags=all_tags,
            all_commits=all_commits,
            sha_only=True,
        )
    )

    for rev in revs:
        res[rev]["baseline"] = _collect_experiment(repo, rev, sha_only=sha_only)

    # collect reproduced experiments
    for exp_branch in repo.experiments.scm.list_branches():
        m = repo.experiments.BRANCH_RE.match(exp_branch)
        if m:
            rev = repo.scm.resolve_rev(m.group("baseline_rev"))
            if rev in revs:
                exp_rev = repo.experiments.scm.resolve_rev(exp_branch)
                with repo.experiments.chdir():
                    experiment = _collect_experiment(
                        repo.experiments.exp_dvc, exp_branch
                    )
                res[rev][exp_rev] = experiment

    # collect queued (not yet reproduced) experiments
    for stash_rev, entry in repo.experiments.stash_revs.items():
        if entry.baseline_rev in revs:
            with repo.experiments.chdir():
                experiment = _collect_experiment(
                    repo.experiments.exp_dvc, stash_rev, stash=True
                )
            res[entry.baseline_rev][stash_rev] = experiment

    return res