From b17c14ae91b5f68e1b0f0c80c256ce984036299c Mon Sep 17 00:00:00 2001 From: Andrej Shadura Date: Sun, 7 Feb 2021 11:11:16 +0100 Subject: gbp.git: Change list_tree to return an iterator When working with huge trees, we want to avoid consuming large amounts of memory just to throw away most of it almost immediately when we only need one entry or a few of them. Signed-off-by: Andrej Shadura --- tests/doctests/test_GitRepository.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/doctests/test_GitRepository.py') diff --git a/tests/doctests/test_GitRepository.py b/tests/doctests/test_GitRepository.py index ca32394a..98fede04 100644 --- a/tests/doctests/test_GitRepository.py +++ b/tests/doctests/test_GitRepository.py @@ -942,15 +942,15 @@ def test_make_tree(): >>> sha1 = repo.write_file('testfile') >>> sha1 '19af7398c894bc5e86e17259317e4db519e9241f' - >>> head = repo.list_tree('HEAD') + >>> head = list(repo.list_tree('HEAD')) >>> head - [['100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', b'testfile']] + [('100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', b'testfile')] >>> head.append(['100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', 'testfile2']) >>> newtree = repo.make_tree(head) >>> newtree '745951810c9e22fcc6de9b23f05efd6ab5512123' - >>> repo.list_tree(newtree, recurse=False, paths='testfile') - [['100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', b'testfile']] + >>> list(repo.list_tree(newtree, recurse=False, paths='testfile')) + [('100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', b'testfile')] >>> repo.make_tree([]) '4b825dc642cb6eb9a060e54bf8d69288fbee4904' """ -- cgit v1.2.3