diff options
author | Guido Guenther <agx@sigxcpu.org> | 2007-10-16 23:45:40 +0200 |
---|---|---|
committer | Guido Guenther <agx@sigxcpu.org> | 2007-10-16 23:45:40 +0200 |
commit | afb4cf9888bd90bce55695e2cff8497d26b01d48 (patch) | |
tree | 506f3ac72d4cfb19d155c37f6598398d09a22221 /gbp/git_utils.py | |
parent | b1806bc331028a3cd034c33f0a05d737f921fd1c (diff) |
add --export-dir and --export (Closes: #446042)
Diffstat (limited to 'gbp/git_utils.py')
-rw-r--r-- | gbp/git_utils.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gbp/git_utils.py b/gbp/git_utils.py index f52550b..9cfb0ec 100644 --- a/gbp/git_utils.py +++ b/gbp/git_utils.py @@ -27,10 +27,10 @@ class GitRepository(object): raise GitRepositoryError - def __git_getoutput(self, command): - """Exec a git command and return the output""" + def __git_getoutput(self, command, args=[]): + """exec a git command and return the output""" output = [] - popen = subprocess.Popen(['git', command], stdout=subprocess.PIPE) + popen = subprocess.Popen(['git', command] + args, stdout=subprocess.PIPE) while popen.poll() == None: output += popen.stdout.readlines() ret = popen.poll() @@ -47,6 +47,13 @@ class GitRepository(object): return False + def has_treeish(self, treeish): + """check if the repository has the treeish object treeish""" + self.__check_path() + out, ret = self.__git_getoutput('ls-tree', [ treeish ]) + return [ True, False ][ret != 0] + + def get_branch(self): """on what branch is the current working copy""" self.__check_path() |