diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-18 23:11:32 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-18 23:11:32 +0100 |
commit | f1545bd9cd6953c5b39c488bf7fe179676060499 (patch) | |
tree | 8bd4b8829768fe0195d41a3aa067aa1ac7435605 /lib/git/objects/base.py | |
parent | a1d1d2cb421f16bd277d7c4ce88398ff0f5afb29 (diff) | |
parent | 7cf2d5fcf0a3db793678dd6ba9fc1c24d4eeb36a (diff) | |
download | gitpython-f1545bd9cd6953c5b39c488bf7fe179676060499.tar.gz |
Merge branch 'submodule'
Diffstat (limited to 'lib/git/objects/base.py')
-rw-r--r-- | lib/git/objects/base.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py index 41862ac2..b8cec47f 100644 --- a/lib/git/objects/base.py +++ b/lib/git/objects/base.py @@ -62,17 +62,6 @@ class Object(LazyMixin): inst.size = oinfo.size return inst - def _set_self_from_args_(self, args_dict): - """Initialize attributes on self from the given dict that was retrieved - from locals() in the calling method. - - Will only set an attribute on self if the corresponding value in args_dict - is not None""" - for attr, val in args_dict.items(): - if attr != "self" and val is not None: - setattr( self, attr, val ) - # END set all non-None attributes - def _set_cache_(self, attr): """Retrieve object information""" if attr == "size": @@ -125,7 +114,10 @@ class Object(LazyMixin): class IndexObject(Object): """Base for all objects that can be part of the index file , namely Tree, Blob and SubModule objects""" - __slots__ = ("path", "mode") + __slots__ = ("path", "mode") + + # for compatability with iterable lists + _id_attribute_ = 'path' def __init__(self, repo, binsha, mode=None, path=None): """Initialize a newly instanced IndexObject @@ -140,7 +132,10 @@ class IndexObject(Object): Path may not be set of the index object has been created directly as it cannot be retrieved without knowing the parent tree.""" super(IndexObject, self).__init__(repo, binsha) - self._set_self_from_args_(locals()) + if mode is not None: + self.mode = mode + if path is not None: + self.path = path def __hash__(self): """:return: |