Module: Gitlab::Client::Repositories
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/repositories.rb
Overview
Defines methods related to repositories.
Instance Method Summary collapse
-
#compare(project, from, to) ⇒ Gitlab::ObjectifiedHash
(also: #repo_compare)
Compares branches, tags or commits.
-
#contributors(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_contributors)
Get project repository contributors.
-
#generate_changelog(project, version, options = {}) ⇒ bool
Generate changelog data.
-
#merge_base(project, refs) ⇒ Gitlab::ObjectifiedHash
Get the common ancestor for 2 refs (commit SHAs, branch names or tags).
-
#repo_archive(project, ref = 'master', format = 'tar.gz') ⇒ Gitlab::FileResponse
Get project repository archive.
-
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash
(also: #repo_tree)
Get file tree project (root level).
Instance Method Details
#compare(project, from, to) ⇒ Gitlab::ObjectifiedHash Also known as: repo_compare
Compares branches, tags or commits.
58 59 60 |
# File 'lib/gitlab/client/repositories.rb', line 58 def compare(project, from, to) get("/projects/#{url_encode project}/repository/compare", query: { from: from, to: to }) end |
#contributors(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_contributors
Get project repository contributors.
87 88 89 |
# File 'lib/gitlab/client/repositories.rb', line 87 def contributors(project, = {}) get("/projects/#{url_encode project}/repository/contributors", query: ) end |
#generate_changelog(project, version, options = {}) ⇒ bool
Generate changelog data
109 110 111 |
# File 'lib/gitlab/client/repositories.rb', line 109 def generate_changelog(project, version, = {}) post("/projects/#{url_encode project}/repository/changelog", body: .merge(version: version)) end |
#merge_base(project, refs) ⇒ Gitlab::ObjectifiedHash
Get the common ancestor for 2 refs (commit SHAs, branch names or tags).
72 73 74 |
# File 'lib/gitlab/client/repositories.rb', line 72 def merge_base(project, refs) get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs }) end |
#repo_archive(project, ref = 'master', format = 'tar.gz') ⇒ Gitlab::FileResponse
Get project repository archive
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gitlab/client/repositories.rb', line 34 def repo_archive(project, ref = 'master', format = 'tar.gz') get("/projects/#{url_encode project}/repository/archive.#{format}", format: nil, headers: { Accept: 'application/octet-stream' }, query: { sha: ref }, parser: proc { |body, _| if body.encoding == Encoding::ASCII_8BIT # binary response ::Gitlab::FileResponse.new StringIO.new(body, 'rb+') else # error with json response ::Gitlab::Request.parse(body) end }) end |
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_tree
Get file tree project (root level).
19 20 21 |
# File 'lib/gitlab/client/repositories.rb', line 19 def tree(project, = {}) get("/projects/#{url_encode project}/repository/tree", query: ) end |