async def revisions( self, # type: ignore path: GitLabPath, **kwargs) -> typing.List[GitLabRevision]: """Get the revision history for the file at ``path``. Returns a list of `GitLabRevision` objects representing each version of the file where the file was modified. API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits Note: ``path`` is not a documented parameter of the above GL endpoint, but seems to work. :param GitLabPath path: The file to fetch revision history for :param dict \*\*kwargs: ignored :rtype: `list` of :class:`GitLabRevision` :raises: :class:`waterbutler.core.exceptions.RevisionsError` """ url = self._build_repo_url('repository', 'commits', path=path.path, ref_name=path.ref) resp = await self.make_request('GET', url, expects=(200, 500), throws=exceptions.RevisionsError) if resp.status == 500: # GitLab API is buggy for unicode filenames. Affected files will still work, but # but will have empty created/modified dates. See docstring for _metadata_file await resp.release() return [] # temporary work around for uncommon bug data = await resp.json() if len(data) == 0: raise exceptions.RevisionsError('No revisions found', code=404) return [GitLabRevision(item) for item in data]
async def revisions(self, path: WaterButlerPath, **kwargs) -> typing.List[DropboxRevision]: # Dropbox v2 API limits the number of revisions returned to a maximum # of 100, default 10. Previously we had set the limit to 250. data = await self.dropbox_request( self.build_url('files', 'list_revisions'), { 'path': path.full_path.rstrip('/'), 'limit': 100 }, throws=exceptions.RevisionsError, ) if data['is_deleted'] is True: raise exceptions.RevisionsError( "Could not retrieve '{}'".format(path), code=HTTPStatus.NOT_FOUND, ) if data['is_deleted']: return [] return [DropboxRevision(item) for item in data['entries']]