From d35a31d1268c6c8edb9f8b8322c5c66cb70ea9ae Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Thu, 8 Mar 2018 19:16:44 +0100 Subject: Add support for recursive tree listing Fixes #452 --- gitlab/v4/objects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gitlab/v4/objects.py') diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 80a6ca5..4ca9dea 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -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) @@ -2424,7 +2425,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): 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: -- cgit v1.2.1