Skip to content

Commit

Permalink
Add support for recursive tree listing
Browse files Browse the repository at this point in the history
Fixes #452
  • Loading branch information
Gauvain Pocentek committed Mar 8, 2018
1 parent 748d57e commit d35a31d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gitlab/v4/objects.py
Expand Up @@ -2403,12 +2403,13 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):

@cli.register_custom_action('Project', tuple(), ('path', 'ref'))
@exc.on_http_error(exc.GitlabGetError)
def repository_tree(self, path='', ref='', **kwargs):
def repository_tree(self, path='', ref='', recursive=False, **kwargs):
"""Return a list of files in the repository.
Args:
path (str): Path of the top folder (/ by default)
ref (str): Reference to a commit or branch
recursive (bool): Whether to get the tree recursively
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
Expand All @@ -2424,7 +2425,7 @@ def repository_tree(self, path='', ref='', **kwargs):
list: The representation of the tree
"""
gl_path = '/projects/%s/repository/tree' % self.get_id()
query_data = {}
query_data = {'recursive': recursive}
if path:
query_data['path'] = path
if ref:
Expand Down

0 comments on commit d35a31d

Please sign in to comment.