diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-07-02 19:54:43 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2010-07-04 16:52:24 +0200 |
commit | b59ed0e946422628b09ec60c35e207f585580fe7 (patch) | |
tree | be1668bda03374203e6d7db7e1f50cbd877d4d83 | |
parent | c210382475f64b735a46513c0661011229436967 (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
-rw-r--r-- | gbp/git.py | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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' |