Пример #1
0
    def _prune_remote(self, branch):
        """Prune remote branch"""

        remote = self._remote if self.fork is None else self.fork.remote_name
        repo = ProjectRepo(self.full_path(), remote, self._ref)
        if repo.existing_remote_branch(branch, remote):
            repo.prune_branch_remote(branch, remote)
Пример #2
0
    def existing_branch(self, branch, is_remote):
        """Check if branch exists"""

        repo = ProjectRepo(self.full_path(), self._remote, self._ref)
        if not is_remote:
            return repo.existing_local_branch(branch)

        rem = self._remote if self.fork is None else self.fork.remote_name
        return repo.existing_remote_branch(branch, rem)
Пример #3
0
    def existing_branch(self, branch, is_remote):
        """Check if branch exists

        :param str branch: Branch to check for
        :param bool is_remote: Check for remote branch
        :return: True, if branch exists
        :rtype: bool
        """

        repo = ProjectRepo(self.full_path(), self.remote, self.ref)
        if not is_remote:
            return repo.existing_local_branch(branch)

        remote = self.remote if self.fork is None else self.fork.remote_name
        return repo.existing_remote_branch(branch, remote)
Пример #4
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)