def _pull(self, *, repo_path: Path=None, git_repo: Repo=None, repo: str=None, branch: str=None,
              depth: Optional[int]=None,
              reference: Optional[Path]=None
              ) -> Repo:
        """
        Returns a :class:`Repo <git.repo.base.Repo>` instance, either pulls existing or
        clones a new copy.
        """
        if git_repo is not None:
            try:
                git_repo.remote().fetch(branch)
                # equivalent to git reset --hard origin/branch
                git_repo.head.reset(f"origin/{branch}", index=True, working_tree=True)
            except GitCommandError:
                raise PullError("There was an error pulling the target repository.")
            return git_repo
        else:
            kwargs: Dict[str, Any] = {}

            if depth is not None:
                kwargs["depth"] = depth

            reference = self.get_reference_repository(reference, repo)

            if reference is not None:
                kwargs["reference-if-able"] = str(reference)
                kwargs["dissociate"] = True

            try:
                return Repo.clone_from(repo, str(repo_path), branch=branch, **kwargs)
            except GitCommandError:
                raise PullError("There was an error cloning the target repository.")
def _pull ( self , * , repo_path : Path = None , git_repo : Repo = None , repo : str = None , branch : str = None , depth : Optional [ int ] = None , reference : Optional [ Path ] = None ) -> Repo : if git_repo is not None : try : git_repo . remote ( ) . fetch ( branch ) git_repo . head . reset ( f"origin/{branch}" , index = True , working_tree = True ) except GitCommandError : raise PullError ( "There was an error pulling the target repository." ) return git_repo else : kwargs : Dict [ str , Any ] = { } if depth is not None : kwargs [ "depth" ] = depth reference = self . get_reference_repository ( reference , repo ) if reference is not None : kwargs [ "reference-if-able" ] = str ( reference ) kwargs [ "dissociate" ] = True try : return Repo . clone_from ( repo , str ( repo_path ) , branch = branch , ** kwargs ) except GitCommandError : raise PullError ( "There was an error cloning the target repository." )
Returns a :class:`Repo <git.repo.base.Repo>` instance, either pulls existing or
        clones a new copy.