diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-12-26 19:25:53 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2010-12-26 23:47:48 +0100 |
commit | b1f081ac53b818e20e1fe3b01bf9f06345b91638 (patch) | |
tree | 24bb8dea4568e438c6dd354b2913a50457e14faa /gbp | |
parent | 83b923514af12388092f09cc281215be6b5eee85 (diff) |
Rewrite gbp-pq in python
so we get consistent logging and debugging options.
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/deb.py | 1 | ||||
-rw-r--r-- | gbp/git.py | 16 |
2 files changed, 14 insertions, 3 deletions
@@ -7,7 +7,6 @@ import commands import email import os import re -import shutil import subprocess import sys import glob @@ -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""" |