Skip to content

Commit d35a31d

Browse files
author
Gauvain Pocentek
committed
Add support for recursive tree listing
Fixes #452
1 parent 748d57e commit d35a31d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gitlab/v4/objects.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,12 +2403,13 @@ 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:
24102410
path (str): Path of the top folder (/ by default)
24112411
ref (str): Reference to a commit or branch
2412+
recursive (bool): Whether to get the tree recursively
24122413
all (bool): If True, return all the items, without pagination
24132414
per_page (int): Number of items to retrieve per request
24142415
page (int): ID of the page to return (starts with page 1)
@@ -2424,7 +2425,7 @@ def repository_tree(self, path='', ref='', **kwargs):
24242425
list: The representation of the tree
24252426
"""
24262427
gl_path = '/projects/%s/repository/tree' % self.get_id()
2427-
query_data = {}
2428+
query_data = {'recursive': recursive}
24282429
if path:
24292430
query_data['path'] = path
24302431
if ref:

0 commit comments

Comments
 (0)