code: def get_revision_sha(self, dest, rev):
          
          # Pass rev to pre-filter the list.
          output = self.run_command(['show-ref', rev], cwd=dest,
                                    show_stdout=False, on_returncode='ignore')
          refs = {}
          for line in output.strip().splitlines():
              try:
                  sha, ref = line.split()
              except ValueError:
                  # Include the offending line to simplify troubleshooting if
                  # this error ever occurs.
                  raise ValueError('unexpected show-ref line: {!r}'.format(line))
  
              refs[ref] = sha
  
          branch_ref = 'refs/remotes/origin/{}'.format(rev)
          tag_ref = 'refs/tags/{}'.format(rev)
  
          sha = refs.get(branch_ref)
          if sha is not None:
              return (sha, True)
  
          sha = refs.get(tag_ref)
  
          return (sha, False)
docs: Return (sha_or_none, is_branch), where sha_or_none is a commit hash
          if the revision names a remote branch or tag, otherwise None.
  
          Args:
            dest: the repository directory.
            rev: the revision name.