Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd415cc0

Browse files
author
Gauvain Pocentek
committed
Update the repository_blob documentation
Fixes#312
1 parent5082879 commitd415cc0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

‎docs/gl_objects/projects.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@
142142
# end repository tree
143143

144144
# repository blob
145-
file_content=p.repository_blob('master','README.rst')
145+
items=project.repository_tree(path='docs',ref='branch1')
146+
file_info=p.repository_blob(items[0]['id'])
147+
content=base64.b64decode(file_info['content'])
148+
size=file_info['size']
146149
# end repository blob
147150

148151
# repository raw_blob

‎docs/gl_objects/projects.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ List the repository tree:
120120
:start-after: # repository tree
121121
:end-before: # end repository tree
122122

123-
Get the content of a file for a commit:
123+
Get the contentand metadataof a file for a commit, using a blob sha:
124124

125125
..literalinclude::projects.py
126126
:start-after: # repository blob

‎gitlab/v4/objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ def repository_tree(self, path='', ref='', **kwargs):
20242024
@cli.register_custom_action('Project', ('sha', ))
20252025
@exc.on_http_error(exc.GitlabGetError)
20262026
defrepository_blob(self,sha,**kwargs):
2027-
"""Return ablob by blob SHA.
2027+
"""Return afile by blob SHA.
20282028
20292029
Args:
20302030
sha(str): ID of the blob
@@ -2035,7 +2035,7 @@ def repository_blob(self, sha, **kwargs):
20352035
GitlabGetError: If the server failed to perform the request
20362036
20372037
Returns:
2038-
str: The blob metadata
2038+
dict: The blob content and metadata
20392039
"""
20402040

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp