summaryrefslogtreecommitdiff
path: root/lib/git/objects/utils.py
diff options
context:
space:
mode:
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")