lib/gitlab/client/branches.rb in gitlab-3.3.0 vs lib/gitlab/client/branches.rb in gitlab-3.4.0

- old
+ new

@@ -1,7 +1,8 @@ class Gitlab::Client # Defines methods related to repositories. + # @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/branches.md module Branches # Gets a list of project repositiory branches. # # @example # Gitlab.branches(42) @@ -26,11 +27,11 @@ # @param [String] branch The name of the branch. # @return [Gitlab::ObjectifiedHash] def branch(project, branch) get("/projects/#{project}/repository/branches/#{branch}") end - + alias_method :repo_branch, :branch # Protects a repository branch. # # @example @@ -71,9 +72,23 @@ # @return [Gitlab::ObjectifiedHash] def create_branch(project, branch, ref) post("/projects/#{project}/repository/branches",:body => {:branch_name => branch, :ref => ref}) end alias_method :repo_create_branch, :create_branch + + # Deletes a repository branch. Requires Gitlab >= 6.8.x + # + # @example + # Gitlab.delete_branch(3, 'api') + # Gitlab.repo_delete_branch(5, 'master') + # + # @param [Integer] project The ID of a project. + # @param [String] branch The name of the branch to delete + # @return [Gitlab::ObjectifiedHash] + def delete_branch(project, branch) + delete("/projects/#{project}/repository/branches/#{branch}") + end + alias_method :repo_delete_branch, :delete_branch end end