summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-22 12:28:04 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-22 12:30:47 +0200
commit4fe5cfa0e063a8d51a1eb6f014e2aaa994e5e7d4 (patch)
treeec39872b88729237e078d55b0c990a1f784360a6 /lib/git
parentf62c9b9c0c9bda792c3fa531b18190e97eb53509 (diff)
downloadgitpython-4fe5cfa0e063a8d51a1eb6f014e2aaa994e5e7d4.tar.gz
Stream_data streams data to a given output stream most efficiently with a low memory footprint.
Still, the git-cat-file command keeps all data in an interal buffer instead of streaming it directly. This is a git design issue though, and will be hard to address without some proper git-hacking. Conflicts: lib/git/cmd.py
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/cmd.py1
-rw-r--r--lib/git/objects/base.py12
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/git/cmd.py b/lib/git/cmd.py
index 27eb20e8..88d6008a 100644
--- a/lib/git/cmd.py
+++ b/lib/git/cmd.py
@@ -183,7 +183,6 @@ class Git(object):
stdout=subprocess.PIPE,
**extra
)
-
if as_process:
return self.AutoInterrupt(proc)
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py
index dd67a3c7..0dfd1a23 100644
--- a/lib/git/objects/base.py
+++ b/lib/git/objects/base.py
@@ -127,6 +127,18 @@ class Object(LazyMixin):
proc = self.repo.git.cat_file(self.type, self.id, as_process=True)
return utils.ProcessStreamAdapter(proc, "stdout")
+ def stream_data(self, ostream):
+ """
+ Writes our data directly to the given output stream
+
+ ``ostream``
+ File object compatible stream object.
+
+ Returns
+ self
+ """
+ self.repo.git.cat_file(self.type, self.id, output_stream=ostream)
+ return self
class IndexObject(Object):
"""