예제 #1
0
    def prune(self, branch, force=False, local=False, remote=False):
        """Prune branch

        .. py:function:: prune(branch, force=False, local=False, remote=False)

        :param str branch: Branch to prune
        :param Optional[bool] force: Force delete branch
        :param Optional[bool] local: Delete local branch
        :param Optional[bool] remote: Delete remote branch
        """

        repo = ProjectRepo(self.full_path(), self.remote, self.ref)

        if local and repo.existing_local_branch(branch):
            repo.prune_branch_local(branch, force)

        if remote:
            git_remote = self.remote if self.fork is None else self.fork.remote_name
            if repo.existing_remote_branch(branch, git_remote):
                repo.prune_branch_remote(branch, git_remote)
예제 #2
0
    def _prune_local(self, branch, force):
        """Prune local branch"""

        repo = ProjectRepo(self.full_path(), self._remote, self._ref)
        if repo.existing_local_branch(branch):
            repo.prune_branch_local(branch, force)