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.
60 61 62 |
# File 'lib/gitlab/client/repositories.rb', line 60 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.
107 108 109 |
# File 'lib/gitlab/client/repositories.rb', line 107 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.
74 75 76 |
# File 'lib/gitlab/client/repositories.rb', line 74 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.
46 47 48 |
# File 'lib/gitlab/client/repositories.rb', line 46 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.
153 154 155 |
# File 'lib/gitlab/client/repositories.rb', line 153 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.
122 123 124 |
# File 'lib/gitlab/client/repositories.rb', line 122 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.
29 30 31 |
# File 'lib/gitlab/client/repositories.rb', line 29 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
89 90 91 92 93 94 |
# File 'lib/gitlab/client/repositories.rb', line 89 def file_contents(project, filepath, ref = 'master') 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.
14 15 16 |
# File 'lib/gitlab/client/repositories.rb', line 14 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).
138 139 140 |
# File 'lib/gitlab/client/repositories.rb', line 138 def tree(project, ={}) get("/projects/#{project}/repository/tree", query: ) end |