code: def test_known_sha(erepo_dir):
      erepo_dir.scm.commit("init")
  
      url = f"file://{erepo_dir.as_posix()}"
      with external_repo(url) as repo:
          rev = repo.scm.get_rev()
          prev_rev = repo.scm.resolve_rev("HEAD^")
  
      # Hits cache
      with external_repo(url, rev) as repo:
          pass
  
      # No clone, no pull, copies a repo, checks out the known sha
      with external_repo(url, prev_rev) as repo:
          pass
  
file_path: dvc/tests/func/test_external_repo.py
imports: import os
  from dvc.repo.open_repo import CLONES
  from dvc.repo.open_repo import _external_repo
  from dvc.scm import Git
  from dvc.testing.tmp_dir import make_subrepo
  from dvc.utils import relpath
  from dvc.utils.fs import remove
  from dvc_data.hashfile.build import build
  from dvc_data.hashfile.transfer import transfer
label_desc: Use image node_id 4 for calling a global function with example usage: test_known_sha(erepo_dir) without return types