From 92a97480edcc0f0de787a752bf90feed0445dd39 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 9 Oct 2009 11:57:48 +0200 Subject: Blob|Tree: renamed 'name' member to 'path', updated tests and changelog as it would make existing code incompatible in some places --- lib/git/tree.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/git/tree.py') diff --git a/lib/git/tree.py b/lib/git/tree.py index cfb0881c..1b546f85 100644 --- a/lib/git/tree.py +++ b/lib/git/tree.py @@ -9,12 +9,12 @@ from lazy import LazyMixin import blob class Tree(LazyMixin): - def __init__(self, repo, id, mode=None, name=None): + def __init__(self, repo, id, mode=None, path=None): LazyMixin.__init__(self) self.repo = repo self.id = id self.mode = mode - self.name = name + self.path = path self._contents = None def __bake__(self): @@ -28,7 +28,7 @@ class Tree(LazyMixin): for line in self.repo.git.ls_tree(self.id).splitlines(): obj = self.content_from_string(self.repo, line) if obj is not None: - self._contents[obj.name] = obj + self._contents[obj.path] = obj @staticmethod def content_from_string(repo, text): @@ -45,14 +45,14 @@ class Tree(LazyMixin): ``git.Blob`` or ``git.Tree`` """ try: - mode, typ, id, name = text.expandtabs(1).split(" ", 3) + mode, typ, id, path = text.expandtabs(1).split(" ", 3) except: return None if typ == "tree": - return Tree(repo, id=id, mode=mode, name=name) + return Tree(repo, id=id, mode=mode, path=path) elif typ == "blob": - return blob.Blob(repo, id=id, mode=mode, name=name) + return blob.Blob(repo, id=id, mode=mode, path=path) elif typ == "commit": return None else: @@ -76,7 +76,7 @@ class Tree(LazyMixin): @property def basename(self): - os.path.basename(self.name) + os.path.basename(self.path) def __repr__(self): return '' % self.id -- cgit v1.2.1