commit - f40a60968957e3982eee437f04b3e515bb2f5493
commit + d58e9cf00fa278b47713604710c3fd40c7676008
blob - d91771e9710ddfbf1e9db3650492dccaaec683c0
blob + 1701cf2d7f1c8a91bcd73b64a42f1ccd38eaa62a
--- dulwich/object_store.py
+++ dulwich/object_store.py
progress=None,
get_tagged=None,
get_parents=lambda commit: commit.parents,
- depth=None,
):
"""Find the missing objects required for a set of revisions.
commit.
Returns: Iterator over (sha, path) pairs.
"""
+ warnings.warn(
+ 'Please use MissingObjectFinder(store)', DeprecationWarning)
finder = MissingObjectFinder(
self,
- haves,
- wants,
- shallow,
- progress,
- get_tagged,
+ haves=haves,
+ wants=wants,
+ shallow=shallow,
+ progress=progress,
+ get_tagged=get_tagged,
get_parents=get_parents,
)
- return iter(finder.next, None)
+ return iter(finder)
def find_common_revisions(self, graphwalker):
"""Find which revisions this store has in common using graphwalker.
shallow: Set of shallow commit SHA1s to skip
progress: Optional progress reporting method
"""
- missing = self.find_missing_objects(have, want, shallow, progress)
+ missing = MissingObjectFinder(
+ self, haves=have, wants=want, shallow=shallow, progress=progress)
return self.iter_shas(missing)
def generate_pack_data(
object_store,
haves,
wants,
+ *,
shallow=None,
progress=None,
get_tagged=None,
def add_todo(self, entries):
self.objects_to_send.update([e for e in entries if not e[0] in self.sha_done])
- def next(self):
+ def __next__(self):
while True:
if not self.objects_to_send:
return None
self.progress(("counting objects: %d\r" % len(self.sha_done)).encode("ascii"))
return (sha, name)
- __next__ = next
+ def __iter__(self):
+ return iter(self.__next__, None)
class ObjectStoreGraphWalker:
blob - 53d889c29e74271cc59631a4ae5bab62f8254bb0
blob + 23912c85cfb8baf084b62829820e7667a99c43ce
--- dulwich/repo.py
+++ dulwich/repo.py
BaseObjectStore,
ObjectStoreGraphWalker,
peel_sha,
+ MissingObjectFinder,
)
from dulwich.objects import (
check_hexsha,
return parents_provider.get_parents(commit.id, commit)
return self.object_store.iter_shas(
- self.object_store.find_missing_objects(
- haves,
- wants,
- self.get_shallow(),
- progress,
- get_tagged,
+ MissingObjectFinder(
+ self.object_store,
+ haves=haves,
+ wants=wants,
+ shallow=self.get_shallow(),
+ progress=progress,
+ get_tagged=get_tagged,
get_parents=get_parents,
)
)
blob - 15826f71c7ba0777d3d4f25b4a5d89626f9697dd
blob + c971db37c0ed0e4c10d39a49a4baefac4c32fa9c
--- dulwich/tests/test_missing_obj_finder.py
+++ dulwich/tests/test_missing_obj_finder.py
from dulwich.object_store import (
MemoryObjectStore,
+ MissingObjectFinder,
)
from dulwich.objects import (
Blob,
return self.commits[n - 1]
def assertMissingMatch(self, haves, wants, expected):
- for sha, path in self.store.find_missing_objects(haves, wants, set()):
+ for sha, path in MissingObjectFinder(self.store, haves, wants, shallow=set()):
self.assertIn(
sha,
expected,
haves = [self.cmt(1).id]
wants = [self.cmt(3).id, bogus_sha]
self.assertRaises(
- KeyError, self.store.find_missing_objects, haves, wants, set()
- )
+ KeyError, MissingObjectFinder, self.store, haves, wants, shallow=set())
def test_no_changes(self):
self.assertMissingMatch([self.cmt(3).id], [self.cmt(3).id], [])