Skip to content

Commit f66540a

Browse files
author
David Garfinkle
committed
Add recursive option to Project.recursive_tree()
1 parent 748d57e commit f66540a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

gitlab/v4/objects.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
24032403

24042404
@cli.register_custom_action('Project', tuple(), ('path', 'ref'))
24052405
@exc.on_http_error(exc.GitlabGetError)
2406-
def repository_tree(self, path='', ref='', **kwargs):
2406+
def repository_tree(self, path='', ref='', recursive=False, **kwargs):
24072407
"""Return a list of files in the repository.
24082408
24092409
Args:
@@ -2429,6 +2429,8 @@ def repository_tree(self, path='', ref='', **kwargs):
24292429
query_data['path'] = path
24302430
if ref:
24312431
query_data['ref'] = ref
2432+
if recursive:
2433+
query_data['recursive'] = recursive
24322434
return self.manager.gitlab.http_list(gl_path, query_data=query_data,
24332435
**kwargs)
24342436

tools/python_test_v4.py

+2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@
385385
archive1 = admin_project.repository_archive()
386386
archive2 = admin_project.repository_archive('master')
387387
assert(archive1 == archive2)
388+
recursive_tree = admin_project.repository_tree(recursive=True)
389+
assert(len(recursive_tree) != 0)
388390

389391
# project file uploads
390392
filename = "test.txt"

0 commit comments

Comments
 (0)