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
-
#commit(project, sha) ⇒ Gitlab::ObjectifiedHash
(also: #repo_commit)
Gets a specific commit identified by the commit hash or name of a branch or tag.
-
#commit_comments(project, commit, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_commit_comments)
Gets a list of comments for a commit.
-
#commit_diff(project, sha) ⇒ Gitlab::ObjectifiedHash
(also: #repo_commit_diff)
Get the diff of a commit in a project.
-
#commits(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_commits)
Gets a list of project commits.
-
#compare(project, from, to) ⇒ Gitlab::ObjectifiedHash
(also: #repo_compare)
Compares branches, tags or commits.
-
#create_commit_comment(project, commit, note, options = {}) ⇒ Gitlab::ObjectifiedHash
(also: #repo_create_commit_comment)
Creates a new comment for a commit.
-
#create_tag(project, tag_name, ref, message = '') ⇒ Gitlab::ObjectifiedHash
(also: #repo_create_tag)
Creates a new project repository tag.
-
#file_contents(project, filepath, ref = 'master') ⇒ String
(also: #repo_file_contents)
Get the contents of a file.
-
#tags(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_tags)
Gets a list of project repository tags.
-
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash
(also: #repo_tree)
Get file tree project (root level).
Instance Method Details
#commit(project, sha) ⇒ Gitlab::ObjectifiedHash Also known as: repo_commit
Gets a specific commit identified by the commit hash or name of a branch or tag.
62 63 64 |
# File 'lib/gitlab/client/repositories.rb', line 62 def commit(project, sha) get("/projects/#{project}/repository/commits/#{sha}") end |
#commit_comments(project, commit, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_commit_comments
Gets a list of comments for a commit.
110 111 112 |
# File 'lib/gitlab/client/repositories.rb', line 110 def commit_comments(project, commit, ={}) get("/projects/#{project}/repository/commits/#{commit}/comments", :query => ) end |
#commit_diff(project, sha) ⇒ Gitlab::ObjectifiedHash Also known as: repo_commit_diff
Get the diff of a commit in a project.
76 77 78 |
# File 'lib/gitlab/client/repositories.rb', line 76 def commit_diff(project, sha) get("/projects/#{project}/repository/commits/#{sha}/diff") end |
#commits(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_commits
Gets a list of project commits.
48 49 50 |
# File 'lib/gitlab/client/repositories.rb', line 48 def commits(project, ={}) get("/projects/#{project}/repository/commits", :query => ) end |
#compare(project, from, to) ⇒ Gitlab::ObjectifiedHash Also known as: repo_compare
Compares branches, tags or commits.
156 157 158 |
# File 'lib/gitlab/client/repositories.rb', line 156 def compare(project, from, to) get("/projects/#{project}/repository/compare", :query => {:from => from, :to => to}) end |
#create_commit_comment(project, commit, note, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_commit_comment
Creates a new comment for a commit.
125 126 127 |
# File 'lib/gitlab/client/repositories.rb', line 125 def create_commit_comment(project, commit, note, ={}) post("/projects/#{project}/repository/commits/#{commit}/comments", :body => .merge(:note => note)) end |
#create_tag(project, tag_name, ref, message = '') ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_tag
Creates a new project repository tag.
31 32 33 |
# File 'lib/gitlab/client/repositories.rb', line 31 def create_tag(project, tag_name, ref, ='') post("/projects/#{project}/repository/tags", body: {tag_name: tag_name, ref: ref, message: }) end |
#file_contents(project, filepath, ref = 'master') ⇒ String Also known as: repo_file_contents
Get the contents of a file
91 92 93 94 95 96 97 |
# File 'lib/gitlab/client/repositories.rb', line 91 def file_contents(project, filepath, ref = 'master') ref = URI.encode(ref, /\W/) get "/projects/#{project}/repository/blobs/#{ref}?filepath=#{filepath}", format: nil, headers: { Accept: 'text/plain' }, parser: ::Gitlab::Request::Parser end |
#tags(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as:
Gets a list of project repository tags.
15 16 17 |
# File 'lib/gitlab/client/repositories.rb', line 15 def (project, ={}) get("/projects/#{project}/repository/tags", :query => ) end |
#tree(project, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_tree
Get file tree project (root level).
141 142 143 |
# File 'lib/gitlab/client/repositories.rb', line 141 def tree(project, ={}) get("/projects/#{project}/repository/tree", query: ) end |