Repository: iterative/dvc

Issue:
dvc exp show -T crashes with unknown Git revision <revision>, <tag name>
## Bug Report

### Please provide information about your setup

when running dvc exp show -T, the program crashes 

**Output of `dvc version`:**

```console
$ dvc version
```
1.7.2
**Additional Information (if any):**

If applicable, please also provide a `--verbose` output of the command, eg: `dvc add --verbose`.
```
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'
```


Discussion:
This happens when some tag and experiment base commit have same git commit hash

Resolving patch:
diff --git a/dvc/repo/brancher.py b/dvc/repo/brancher.py
--- a/dvc/repo/brancher.py
+++ b/dvc/repo/brancher.py
@@ -4,7 +4,12 @@
 
 
 def brancher(  # noqa: E302
-    self, revs=None, all_branches=False, all_tags=False, all_commits=False
+    self,
+    revs=None,
+    all_branches=False,
+    all_tags=False,
+    all_commits=False,
+    sha_only=False,
 ):
     """Generator that iterates over specified revisions.
 
@@ -13,6 +18,7 @@ def brancher(  # noqa: E302
         all_branches (bool): iterate over all available branches.
         all_commits (bool): iterate over all commits.
         all_tags (bool): iterate over all available tags.
+        sha_only (bool): only return git SHA for a revision.
 
     Yields:
         str: the display name for the currently selected tree, it could be:
@@ -53,6 +59,9 @@ def brancher(  # noqa: E302
                 # ignore revs that don't contain repo root
                 # (i.e. revs from before a subdir=True repo was init'ed)
                 if self.tree.exists(self.root_dir):
-                    yield ", ".join(names)
+                    if sha_only:
+                        yield sha
+                    else:
+                        yield ", ".join(names)
     finally:
         self.tree = saved_tree
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
@@ -17,7 +17,7 @@ def _collect_experiment(repo, branch, stash=False, sha_only=True):
         if rev == "workspace":
             res["timestamp"] = None
         else:
-            commit = repo.scm.repo.rev_parse(rev)
+            commit = _resolve_commit(repo, rev)
             res["timestamp"] = datetime.fromtimestamp(commit.committed_date)
 
         configs = _collect_configs(repo)
@@ -44,6 +44,15 @@ def _collect_experiment(repo, branch, stash=False, sha_only=True):
     return res
 
 
+def _resolve_commit(repo, rev):
+    from git.objects.tag import TagObject
+
+    commit = repo.scm.repo.rev_parse(rev)
+    if isinstance(commit, TagObject):
+        commit = commit.object
+    return commit
+
+
 @locked
 def show(
     repo,
@@ -65,6 +74,7 @@ def show(
             all_branches=all_branches,
             all_tags=all_tags,
             all_commits=all_commits,
+            sha_only=True,
         )
     )
 


Test patch: