Skip to content

Commit

Permalink
Update the repository_blob documentation
Browse files Browse the repository at this point in the history
Fixes #312
  • Loading branch information
Gauvain Pocentek committed Nov 1, 2017
1 parent 5082879 commit d415cc0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion docs/gl_objects/projects.py
Expand Up @@ -142,7 +142,10 @@
# end repository tree

# repository blob
file_content = p.repository_blob('master', 'README.rst')
items = project.repository_tree(path='docs', ref='branch1')
file_info = p.repository_blob(items[0]['id'])
content = base64.b64decode(file_info['content'])
size = file_info['size']
# end repository blob

# repository raw_blob
Expand Down
2 changes: 1 addition & 1 deletion docs/gl_objects/projects.rst
Expand Up @@ -120,7 +120,7 @@ List the repository tree:
:start-after: # repository tree
:end-before: # end repository tree

Get the content of a file for a commit:
Get the content and metadata of a file for a commit, using a blob sha:

.. literalinclude:: projects.py
:start-after: # repository blob
Expand Down
4 changes: 2 additions & 2 deletions gitlab/v4/objects.py
Expand Up @@ -2024,7 +2024,7 @@ def repository_tree(self, path='', ref='', **kwargs):
@cli.register_custom_action('Project', ('sha', ))
@exc.on_http_error(exc.GitlabGetError)
def repository_blob(self, sha, **kwargs):
"""Return a blob by blob SHA.
"""Return a file by blob SHA.
Args:
sha(str): ID of the blob
Expand All @@ -2035,7 +2035,7 @@ def repository_blob(self, sha, **kwargs):
GitlabGetError: If the server failed to perform the request
Returns:
str: The blob metadata
dict: The blob content and metadata
"""

path = '/projects/%s/repository/blobs/%s' % (self.get_id(), sha)
Expand Down

0 comments on commit d415cc0

Please sign in to comment.