commit d87326ab44010855fb3fb6b174f06393981ab44b from: Jelmer Vernooij via: GitHub date: Tue Mar 14 00:07:08 2023 UTC Merge pull request #1160 from jelmer/memory-repo-fetch-fix Fix fetching into MemoryRepo commit - dcdafdf7db10d59342377a05c8083f2ddb9de664 commit + d87326ab44010855fb3fb6b174f06393981ab44b blob - 5be4952673eb40b1cf7cc9c1dde1ebc55225ecfa blob + 43ced4d67ba8e0cf0069e523d5112f6b9d8e6d77 --- NEWS +++ NEWS @@ -1,6 +1,8 @@ 0.21.4 UNRELEASED * Deprecate ``dulwich.objects.parse_commit``. + + * Fix fetching into MemoryRepo. (Jelmer Vernooij, #1157) 0.21.3 2023-02-17 blob - 8888696eb32096633c2186145ded8b46ab4e66d2 blob + 4446c75932bed0a4940a1c23faeb9468ff51b542 --- dulwich/object_store.py +++ dulwich/object_store.py @@ -1047,6 +1047,16 @@ class MemoryObjectStore(BaseObjectStore): f.close() return f, commit, abort + + def add_pack_data(self, count: int, unpacked_objects: Iterator[UnpackedObject], progress=None) -> None: + """Add pack data to this object store. + + Args: + count: Number of items to add + pack_data: Iterator over pack data tuples + """ + for unpacked_object in unpacked_objects: + self.add_object(unpacked_object.sha_file()) def add_thin_pack(self, read_all, read_some, progress=None): """Add a new thin pack to this object store. blob - 7fa631a1860cb55b048412d26832e9334948f493 blob + bcb827796de11c271ad45a28261de67c0b6c6d27 --- dulwich/tests/test_repository.py +++ dulwich/tests/test_repository.py @@ -123,6 +123,12 @@ class MemoryRepoTests(TestCase): description = b"Some description" r.set_description(description) self.assertEqual(description, r.get_description()) + + def test_pull_into(self): + r = MemoryRepo.init_bare([], {}) + repo = open_repo("a.git") + self.addCleanup(tear_down_repo, repo) + repo.fetch(r) class RepositoryRootTests(TestCase):