summaryrefslogtreecommitdiff
path: root/lib/git/objects/utils.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-11-04 19:53:42 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-11-04 19:53:42 +0100
commitd884adc80c80300b4cc05321494713904ef1df2d (patch)
tree3878d5e0282531596d42505d8725482dde002c20 /lib/git/objects/utils.py
parent05d2687afcc78cd192714ee3d71fdf36a37d110f (diff)
parentace1fed6321bb8dd6d38b2f58d7cf815fa16db7a (diff)
downloadgitpython-d884adc80c80300b4cc05321494713904ef1df2d.tar.gz
Merge branch 'improvements'
Diffstat (limited to 'lib/git/objects/utils.py')
-rw-r--r--lib/git/objects/utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/git/objects/utils.py b/lib/git/objects/utils.py
index 367ed2b7..7bb4e8e2 100644
--- a/lib/git/objects/utils.py
+++ b/lib/git/objects/utils.py
@@ -52,3 +52,21 @@ def parse_actor_and_date(line):
m = _re_actor_epoch.search(line)
actor, epoch = m.groups()
return (Actor._from_string(actor), int(epoch))
+
+
+
+class ProcessStreamAdapter(object):
+ """
+ Class wireing all calls to the contained Process instance.
+
+ Use this type to hide the underlying process to provide access only to a specified
+ stream. The process is usually wrapped into an AutoInterrupt class to kill
+ it if the instance goes out of scope.
+ """
+ __slots__ = ("_proc", "_stream")
+ def __init__(self, process, stream_name):
+ self._proc = process
+ self._stream = getattr(process, stream_name)
+
+ def __getattr__(self, attr):
+ return getattr(self._stream, attr)