summaryrefslogtreecommitdiff
path: root/lib/git/objects/utils.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-02 12:30:33 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-02 12:51:05 +0200
commit8c1a87d11df666d308d14e4ae7ee0e9d614296b6 (patch)
tree87481ab28367db496886a3801bda37227c10f7ed /lib/git/objects/utils.py
parentdf0892351a394d768489b5647d47b73c24d3ef5f (diff)
downloadgitpython-8c1a87d11df666d308d14e4ae7ee0e9d614296b6.tar.gz
commit: refactored existing code to decode commits from streams - performance is slightly better
git.cmd: added method to provide access to the content stream directly. This is more efficient if large objects are handled, if it is actually used test.helpers: removed unnecessary code
Diffstat (limited to 'lib/git/objects/utils.py')
-rw-r--r--lib/git/objects/utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/git/objects/utils.py b/lib/git/objects/utils.py
index 7060e293..6d378a72 100644
--- a/lib/git/objects/utils.py
+++ b/lib/git/objects/utils.py
@@ -280,3 +280,20 @@ class Traversable(object):
addToStack( stack, item, branch_first, nd )
# END for each item on work stack
+
+
+class Serializable(object):
+ """Defines methods to serialize and deserialize objects from and into a data stream"""
+
+ def _serialize(self, stream):
+ """Serialize the data of this object into the given data stream
+ :note: a serialized object would ``_deserialize`` into the same objet
+ :param stream: a file-like object
+ :return: self"""
+ raise NotImplementedError("To be implemented in subclass")
+
+ def _deserialize(self, stream):
+ """Deserialize all information regarding this object from the stream
+ :param stream: a file-like object
+ :return: self"""
+ raise NotImplementedError("To be implemented in subclass")