diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-09 11:57:48 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-09 11:57:48 +0200 |
commit | 92a97480edcc0f0de787a752bf90feed0445dd39 (patch) | |
tree | 518c00ba9840a2d6f32ffa7a876d7efa98016a03 /lib/git/tree.py | |
parent | 2b7f5cb25e0e03e06ec506d31c001c172dd71ef6 (diff) | |
download | gitpython-92a97480edcc0f0de787a752bf90feed0445dd39.tar.gz |
Blob|Tree: renamed 'name' member to 'path', updated tests and changelog as it would make existing code incompatible in some places
Diffstat (limited to 'lib/git/tree.py')
-rw-r--r-- | lib/git/tree.py | 14 |
1 files changed, 7 insertions, 7 deletions
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 '<git.Tree "%s">' % self.id |