Commit a466b2175adc6021a75f31baabbaa42b14203d44
1 parent
5768f98d
Exists in
master
and in
4 other branches
Add create_branch, rm_branch methods to Gitlab::Shell class
Showing
1 changed file
with
25 additions
and
0 deletions
Show diff stats
lib/gitlab/backend/shell.rb
... | ... | @@ -71,6 +71,31 @@ module Gitlab |
71 | 71 | system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-project", "#{name}.git" |
72 | 72 | end |
73 | 73 | |
74 | + # Add repository branch from passed ref | |
75 | + # | |
76 | + # path - project path with namespace | |
77 | + # branch_name - new branch name | |
78 | + # ref - HEAD for new branch | |
79 | + # | |
80 | + # Ex. | |
81 | + # add_branch("gitlab/gitlab-ci", "4-0-stable", "master") | |
82 | + # | |
83 | + def add_branch(path, branch_name, ref) | |
84 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "create-branch", "#{path}.git", branch_name, ref | |
85 | + end | |
86 | + | |
87 | + # Remove repository branch | |
88 | + # | |
89 | + # path - project path with namespace | |
90 | + # branch_name - branch name to remove | |
91 | + # | |
92 | + # Ex. | |
93 | + # rm_branch("gitlab/gitlab-ci", "4-0-stable") | |
94 | + # | |
95 | + def rm_branch(path, branch_name) | |
96 | + system "#{gitlab_shell_user_home}/gitlab-shell/bin/gitlab-projects", "rm-branch", "#{path}.git", branch_name | |
97 | + end | |
98 | + | |
74 | 99 | # Add new key to gitlab-shell |
75 | 100 | # |
76 | 101 | # Ex. | ... | ... |