Browse Source

Implement Tree.__len__.

Jelmer Vernooij 15 years ago
parent
commit
6044fe5f25
1 changed files with 3 additions and 0 deletions
  1. 3 0
      dulwich/objects.py

+ 3 - 0
dulwich/objects.py

@@ -428,6 +428,9 @@ class Tree(ShaFile):
         del self._entries[name]
         del self._entries[name]
         self._needs_serialization = True
         self._needs_serialization = True
 
 
+    def __len__(self):
+        return len(self._entries)
+
     def add(self, mode, name, hexsha):
     def add(self, mode, name, hexsha):
         assert type(mode) == int
         assert type(mode) == int
         assert type(name) == str
         assert type(name) == str