parameters: (cls, repo, head=None, branch=None, remote=None, version=None,
                    email=None)
return_statement: return cls(head=head, email=email, branch=branch, remote=remote,
                     version=version)
docstring: Initialize from a repository
  
          Optionally override detected remote, branch, head, and/or version.
docstring_summary: Initialize from a repository
docstring_tokens: Initialize from a repository
function: def from_repo(cls, repo, head=None, branch=None, remote=None, version=None,
                    email=None):
          """Initialize from a repository
  
          Optionally override detected remote, branch, head, and/or version.
          """
          assert isinstance(repo, Repo)
  
          if head is None:
              head = str(repo.head.target)
          if branch is None:
              branch = repo.branch.branch_name
          if remote is None:
              remote = repo.remote_url
          if version is None:
              version = get_version(repo.path)
          if email is None:
              email = repo.user_email
  
          return cls(head=head, email=email, branch=branch, remote=remote,
                     version=version)
function_tokens: def from_repo ( cls , repo , head = None , branch = None , remote = None , version = None , email = None ) : assert isinstance ( repo , Repo ) if head is None : head = str ( repo . head . target ) if branch is None : branch = repo . branch . branch_name if remote is None : remote = repo . remote_url if version is None : version = get_version ( repo . path ) if email is None : email = repo . user_email return cls ( head = head , email = email , branch = branch , remote = remote , version = version )