From 9ee31065abea645cbc2cf3e54b691d5983a228b2 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 11 Oct 2009 11:01:12 +0200 Subject: Intermediate commit: commit,tree and blob objects now derive from object - test is in place which still fails on purpose. Need to integrate tags which can be objects or just a special form of a ref --- lib/git/tree.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/git/tree.py') diff --git a/lib/git/tree.py b/lib/git/tree.py index 06c1a158..6215f875 100644 --- a/lib/git/tree.py +++ b/lib/git/tree.py @@ -5,25 +5,22 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os -from base import LazyMixin import blob +import base -class Tree(LazyMixin): +class Tree(base.Object): + + type = "tree" + def __init__(self, repo, id, mode=None, path=None): - LazyMixin.__init__(self) - self.repo = repo - self.id = id + super(Tree, self).__init__(repo, id) self.mode = mode self.path = path self._contents = None def __bake__(self): - # Ensure the treeish references directly a tree - treeish = self.id - if not treeish.endswith(':'): - treeish = treeish + ':' - # Read the tree contents. + super(Tree, self).__bake__() self._contents = {} for line in self.repo.git.ls_tree(self.id).splitlines(): obj = self.content_from_string(self.repo, line) -- cgit v1.2.1