git.samba.org
/
jelmer
/
dulwich-libgit2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
09a6d51
)
Extend ObjectIterator a bit.
author
Jelmer Vernooij
<jelmer@samba.org>
Thu, 5 Feb 2009 01:14:44 +0000
(
01:14
+0000)
committer
Jelmer Vernooij
<jelmer@samba.org>
Thu, 5 Feb 2009 01:14:44 +0000
(
01:14
+0000)
dulwich/object_store.py
patch
|
blob
|
history
diff --git
a/dulwich/object_store.py
b/dulwich/object_store.py
index dc282bbf23d3d81ab89fe5df4fa7105ef2ff0709..71d605ddde0c86efae95fc21a6af575e0c30773b 100644
(file)
--- a/
dulwich/object_store.py
+++ b/
dulwich/object_store.py
@@
-197,5
+197,19
@@
class ObjectIterator(object):
def __iter__(self):
return ((self.store.get_object(sha), path) for sha, path in self.shas)
+ def iterobjects(self):
+ for o, path in self:
+ yield o
+
+ def __contains__(self, needle):
+ # FIXME: This could be more efficient
+ for sha, path in self.shas:
+ if sha == needle:
+ return True
+ return False
+
+ def __getitem__(self, key):
+ return self.store[key]
+
def __len__(self):
return len(self.shas)