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)
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)
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)
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)