Module: Gitlab::Client::Commits
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/commits.rb
Overview
Defines methods related to repository commits.
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.
-
#commit_status(id, sha, options = {}) ⇒ Object
(also: #repo_commit_status)
Get the status of a commit.
-
#commits(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_commits)
Gets a list of project commits.
-
#create_commit_comment(project, commit, note, options = {}) ⇒ Gitlab::ObjectifiedHash
(also: #repo_create_commit_comment)
Creates a new comment for a commit.
-
#update_commit_status(id, sha, state, options = {}) ⇒ Object
(also: #repo_update_commit_status)
Adds or updates a status of a commit.
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.
31 32 33 |
# File 'lib/gitlab/client/commits.rb', line 31 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.
60 61 62 |
# File 'lib/gitlab/client/commits.rb', line 60 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.
45 46 47 |
# File 'lib/gitlab/client/commits.rb', line 45 def commit_diff(project, sha) get("/projects/#{project}/repository/commits/#{sha}/diff") end |
#commit_status(id, sha, options = {}) ⇒ Object Also known as: repo_commit_status
Get the status of a commit
97 98 99 |
# File 'lib/gitlab/client/commits.rb', line 97 def commit_status(id, sha, ={}) get("/projects/#{id}/repository/commits/#{sha}/statuses", query: ) end |
#commits(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_commits
Gets a list of project commits.
17 18 19 |
# File 'lib/gitlab/client/commits.rb', line 17 def commits(project, ={}) get("/projects/#{project}/repository/commits", query: ) end |
#create_commit_comment(project, commit, note, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_commit_comment
Creates a new comment for a commit.
78 79 80 |
# File 'lib/gitlab/client/commits.rb', line 78 def create_commit_comment(project, commit, note, ={}) post("/projects/#{project}/repository/commits/#{commit}/comments", body: .merge(note: note)) end |
#update_commit_status(id, sha, state, options = {}) ⇒ Object Also known as: repo_update_commit_status
Adds or updates a status of a commit.
116 117 118 |
# File 'lib/gitlab/client/commits.rb', line 116 def update_commit_status(id, sha, state, ={}) post("/projects/#{id}/statuses/#{sha}", query: .merge(state: state)) end |