diff options
author | Andrej Shadura <andrew.shadura@collabora.co.uk> | 2021-02-07 11:11:16 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2021-03-11 12:48:47 +0100 |
commit | b17c14ae91b5f68e1b0f0c80c256ce984036299c (patch) | |
tree | 9828352181574da5688710f7b4d7a1c1ccbfddc4 /tests/doctests/test_GitRepository.py | |
parent | d6a92cc6c1b4ac86ae0e83929bc33b5fca1e6359 (diff) |
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 <andrew.shadura@collabora.co.uk>
Diffstat (limited to 'tests/doctests/test_GitRepository.py')
-rw-r--r-- | tests/doctests/test_GitRepository.py | 8 |
1 files changed, 4 insertions, 4 deletions
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' """ |