summaryrefslogtreecommitdiff
path: root/gbp/git.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-25 12:42:15 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-26 10:00:54 +0200
commit054d3f574559ae199469a07a1c17931610590dcb (patch)
tree32d4a2d4dc7fd1e4d7cbebe5ca564b84dc089850 /gbp/git.py
parent8ec3769556273e96d128f7203151284bd6765bdd (diff)
GitRepository: Allow to delete remote branches
Diffstat (limited to 'gbp/git.py')
-rw-r--r--gbp/git.py10
1 files changed, 8 insertions, 2 deletions
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"