summaryrefslogtreecommitdiff
path: root/gbp/git.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-07-02 19:54:43 +0200
committerGuido Günther <agx@sigxcpu.org>2010-07-04 16:52:24 +0200
commitb59ed0e946422628b09ec60c35e207f585580fe7 (patch)
treebe1668bda03374203e6d7db7e1f50cbd877d4d83 /gbp/git.py
parentc210382475f64b735a46513c0661011229436967 (diff)
Add __git_inout
to send data to stdin of a git command and receive it's output. Only for small amounts of output data such as a SHA1. Git-Dch: Ignore
Diffstat (limited to 'gbp/git.py')
-rw-r--r--gbp/git.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 5a8953e..32bed45 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -39,6 +39,17 @@ class GitRepository(object):
output += popen.stdout.readlines()
return output, ret
+ def __git_inout(self, command, args, input):
+ """Send input and return output (stdout)"""
+ ret = False
+ popen = subprocess.Popen(['git', command ] + args,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE)
+ (stdin, stderr) = popen.communicate(input)
+ if popen.returncode:
+ stdin = None
+ return stdin
+
def has_branch(self, branch, remote=False):
"""
check if the repository has branch 'branch'