aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-12-26 19:25:53 +0100
committerGuido Günther <agx@sigxcpu.org>2010-12-26 23:47:48 +0100
commitb1f081ac53b818e20e1fe3b01bf9f06345b91638 (patch)
tree24bb8dea4568e438c6dd354b2913a50457e14faa /gbp
parent83b923514af12388092f09cc281215be6b5eee85 (diff)
Rewrite gbp-pq in python
so we get consistent logging and debugging options.
Diffstat (limited to 'gbp')
-rw-r--r--gbp/deb.py1
-rw-r--r--gbp/git.py16
2 files changed, 14 insertions, 3 deletions
diff --git a/gbp/deb.py b/gbp/deb.py
index 12871793..1a53563c 100644
--- a/gbp/deb.py
+++ b/gbp/deb.py
@@ -7,7 +7,6 @@ import commands
import email
import os
import re
-import shutil
import subprocess
import sys
import glob
diff --git a/gbp/git.py b/gbp/git.py
index 4ecbdd55..aa6b0477 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -55,7 +55,6 @@ class GitRepository(object):
def __git_inout(self, command, args, input, extra_env=None):
"""Send input and return output (stdout)"""
- ret = False
env = self.__build_env(extra_env)
popen = subprocess.Popen(['git', command ] + args,
stdin=subprocess.PIPE,
@@ -197,6 +196,13 @@ class GitRepository(object):
if self.get_branch() != branch:
GitCheckoutBranch(branch)()
+ def delete_branch(self, branch):
+ self.__check_path()
+ if self.get_branch() != branch:
+ GitCommand("branch")(["-D", branch])
+ else:
+ raise GitRepositoryError, "Can't delete the branch you're on"
+
def force_head(self, commit, hard=False):
"""force head to a specific commit"""
args = []
@@ -256,7 +262,8 @@ class GitRepository(object):
range +
paths)
if ret:
- raise GitRepositoryError, "Error getting commits %s..%s%s" % (since, until,["", " on %s" % paths][len(paths) > 0] )
+ raise GitRepositoryError, ("Error getting commits %s..%s%s" %
+ (since, until,["", " on %s" % paths][len(paths) > 0] ))
return [ commit.strip() for commit in commits[::-1] ]
def show(self, id):
@@ -447,6 +454,11 @@ class GitRepository(object):
out = self.__git_getoutput('for-each-ref', args)[0]
return [ ref.strip() for ref in out ]
+ def format_patches(self, start, end, output_dir):
+ options = [ '-N', '-k', '-o', output_dir, '%s...%s' % (start, end) ]
+ output, ret = self.__git_getoutput('format-patch', options)
+ return [ line.strip() for line in output ]
+
class FastImport(object):
"""Invoke git-fast-import"""