Module: Gitlab::Client::Branches
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/branches.rb
Overview
Defines methods related to repositories.
Instance Method Summary collapse
-
#branch(project, branch) ⇒ Gitlab::ObjectifiedHash
(also: #repo_branch)
Gets information about a repository branch.
-
#branches(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_branches)
Gets a list of project repositiory branches.
-
#create_branch(project, branch, ref) ⇒ Gitlab::ObjectifiedHash
(also: #repo_create_branch)
Creates a repository branch.
-
#delete_branch(project, branch) ⇒ Object
(also: #repo_delete_branch)
Deletes a repository branch.
-
#delete_merged_branches(project) ⇒ nil
(also: #repo_delete_merged_branches)
Delete all branches that are merged into the project default branch.
-
#protect_branch(project, branch, options = {}) ⇒ Gitlab::ObjectifiedHash
(also: #repo_protect_branch)
Protects a repository branch.
-
#protected_branch(project, branch) ⇒ Gitlab::ObjectifiedHash
(also: #repo_protected_branch)
Gets a single protected branch or wildcard protected branch.
-
#protected_branches(project) ⇒ Array<Gitlab::ObjectifiedHash>
(also: #repo_protected_branches)
Gets a list of protected branches from a project.
-
#unprotect_branch(project, branch) ⇒ Gitlab::ObjectifiedHash
(also: #repo_unprotect_branch)
Unprotects a repository branch.
Instance Method Details
#branch(project, branch) ⇒ Gitlab::ObjectifiedHash Also known as: repo_branch
Gets information about a repository branch.
31 32 33 |
# File 'lib/gitlab/client/branches.rb', line 31 def branch(project, branch) get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end |
#branches(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_branches
Gets a list of project repositiory branches.
17 18 19 |
# File 'lib/gitlab/client/branches.rb', line 17 def branches(project, = {}) get("/projects/#{url_encode project}/repository/branches", query: ) end |
#create_branch(project, branch, ref) ⇒ Gitlab::ObjectifiedHash Also known as: repo_create_branch
Creates a repository branch. Requires Gitlab >= 6.8.x
80 81 82 |
# File 'lib/gitlab/client/branches.rb', line 80 def create_branch(project, branch, ref) post("/projects/#{url_encode project}/repository/branches", query: { branch: branch, ref: ref }) end |
#delete_branch(project, branch) ⇒ Object Also known as: repo_delete_branch
Deletes a repository branch. Requires Gitlab >= 6.8.x
93 94 95 |
# File 'lib/gitlab/client/branches.rb', line 93 def delete_branch(project, branch) delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end |
#delete_merged_branches(project) ⇒ nil Also known as: repo_delete_merged_branches
Delete all branches that are merged into the project default branch. Protected branches will not be deleted as part of this operation.
105 106 107 |
# File 'lib/gitlab/client/branches.rb', line 105 def delete_merged_branches(project) delete("/projects/#{url_encode project}/repository/merged_branches") end |
#protect_branch(project, branch, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: repo_protect_branch
Protects a repository branch.
To update options, call ‘protect_branch` again with new options (i.e. `developers_can_push: false`)
51 52 53 |
# File 'lib/gitlab/client/branches.rb', line 51 def protect_branch(project, branch, = {}) post("/projects/#{url_encode project}/protected_branches", body: { name: branch }.merge()) end |
#protected_branch(project, branch) ⇒ Gitlab::ObjectifiedHash Also known as: repo_protected_branch
Gets a single protected branch or wildcard protected branch
130 131 132 |
# File 'lib/gitlab/client/branches.rb', line 130 def protected_branch(project, branch) get("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") end |
#protected_branches(project) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: repo_protected_branches
Gets a list of protected branches from a project.
117 118 119 |
# File 'lib/gitlab/client/branches.rb', line 117 def protected_branches(project) get("/projects/#{url_encode project}/protected_branches") end |
#unprotect_branch(project, branch) ⇒ Gitlab::ObjectifiedHash Also known as: repo_unprotect_branch
Unprotects a repository branch.
65 66 67 |
# File 'lib/gitlab/client/branches.rb', line 65 def unprotect_branch(project, branch) delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") end |