parameters: (cls, dest, url, rev_options)
return_statement: return rev_options
docstring: Resolve a revision to a new RevOptions object with the SHA1 of the
          branch, tag, or ref if found.
  
          Args:
            rev_options: a RevOptions object.
docstring_summary: Resolve a revision to a new RevOptions object with the SHA1 of the
          branch, tag, or ref if found.
docstring_tokens: Resolve a revision to a new RevOptions object with the SHA1 of the branch tag or ref if found .
function: def resolve_revision(cls, dest, url, rev_options):
          """
          Resolve a revision to a new RevOptions object with the SHA1 of the
          branch, tag, or ref if found.
  
          Args:
            rev_options: a RevOptions object.
          """
          rev = rev_options.arg_rev
          sha, is_branch = cls.get_revision_sha(dest, rev)
  
          if sha is not None:
              rev_options = rev_options.make_new(sha)
              rev_options.branch_name = rev if is_branch else None
  
              return rev_options
  
          # Do not show a warning for the common case of something that has
          # the form of a Git commit hash.
          if not looks_like_hash(rev):
              logger.warning(
                  "Did not find branch or tag '%s', assuming revision or ref.",
                  rev,
              )
  
          if not rev.startswith('refs/'):
              return rev_options
  
          # If it looks like a ref, we have to fetch it explicitly.
          cls.run_command(
              ['fetch', '-q', url] + rev_options.to_args(),
              cwd=dest,
          )
          # Change the revision to the SHA of the ref we fetched
          sha = cls.get_revision(dest, rev='FETCH_HEAD')
          rev_options = rev_options.make_new(sha)
  
          return rev_options
function_tokens: def resolve_revision ( cls , dest , url , rev_options ) : rev = rev_options . arg_rev sha , is_branch = cls . get_revision_sha ( dest , rev ) if sha is not None : rev_options = rev_options . make_new ( sha ) rev_options . branch_name = rev if is_branch else None return rev_options # Do not show a warning for the common case of something that has # the form of a Git commit hash. if not looks_like_hash ( rev ) : logger . warning ( "Did not find branch or tag '%s', assuming revision or ref." , rev , ) if not rev . startswith ( 'refs/' ) : return rev_options # If it looks like a ref, we have to fetch it explicitly. cls . run_command ( [ 'fetch' , '-q' , url ] + rev_options . to_args ( ) , cwd = dest , ) # Change the revision to the SHA of the ref we fetched sha = cls . get_revision ( dest , rev = 'FETCH_HEAD' ) rev_options = rev_options . make_new ( sha ) return rev_options