From 054d3f574559ae199469a07a1c17931610590dcb Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 25 Oct 2011 12:42:15 +0200 Subject: GitRepository: Allow to delete remote branches --- gbp/git.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gbp/git.py') diff --git a/gbp/git.py b/gbp/git.py index f52b09b..8c0debf 100644 --- a/gbp/git.py +++ b/gbp/git.py @@ -388,14 +388,20 @@ class GitRepository(object): self._git_command("branch", args) - def delete_branch(self, branch): + def delete_branch(self, branch, remote=False): """ Delete branch 'branch' @param branch: name of the branch to delete + @type branch: string + @param remote: delete a remote branch + @param remote: bool """ + args = [ "-D" ] + args += [ "-r" ] if remote else [] + if self.get_branch() != branch: - self._git_command("branch", ["-D", branch]) + self._git_command("branch", args + [branch]) else: raise GitRepositoryError, "Can't delete the branch you're on" -- cgit v1.2.3