commit 85a39f5547a4511dbec816c423e41d9ba4c263ce from: Jelmer Vernooij via: GitHub date: Wed Jan 25 20:12:07 2023 UTC Merge pull request #1137 from jelmer/find-missing-objects Reintroduce ObjectStore.find_missing_objects, used by hg-git commit - 60549c54bcc1bb592a27c0bb895c100a0ddc5c91 commit + 85a39f5547a4511dbec816c423e41d9ba4c263ce blob - 0ae6a2f84b43eb82a57af0cad422e76a523329fb blob + dcbb8d8601fb565df7a97da77232808dbbe6975e --- dulwich/object_store.py +++ dulwich/object_store.py @@ -227,6 +227,42 @@ class BaseObjectStore: except KeyError: if not allow_missing: raise + + def find_missing_objects( + self, + haves, + wants, + shallow=None, + progress=None, + get_tagged=None, + get_parents=lambda commit: commit.parents, + ): + """Find the missing objects required for a set of revisions. + + Args: + haves: Iterable over SHAs already in common. + wants: Iterable over SHAs of objects to fetch. + shallow: Set of shallow commit SHA1s to skip + progress: Simple progress function that will be called with + updated progress strings. + get_tagged: Function that returns a dict of pointed-to sha -> + tag sha for including tags. + get_parents: Optional function for getting the parents of a + commit. + Returns: Iterator over (sha, path) pairs. + """ + warnings.warn( + 'Please use MissingObjectFinder(store)', DeprecationWarning) + finder = MissingObjectFinder( + self, + haves=haves, + wants=wants, + shallow=shallow, + progress=progress, + get_tagged=get_tagged, + get_parents=get_parents, + ) + return iter(finder) def find_common_revisions(self, graphwalker): """Find which revisions this store has in common using graphwalker.