Commit 42caddb2 authored by Rubén Dávila's avatar Rubén Dávila

Add new commands: push-branches and delete-remote-branches.

parent 9f482f8d
v2.6.13
- Add push-branches command
- Add delete-remote-branches command
v2.6.12 v2.6.12
- Fix git-annex issue not working using custom SSH port repositories - Fix git-annex issue not working using custom SSH port repositories
......
...@@ -61,6 +61,8 @@ class GitlabProjects ...@@ -61,6 +61,8 @@ class GitlabProjects
when 'fork-project'; fork_project when 'fork-project'; fork_project
when 'fetch-remote'; fetch_remote when 'fetch-remote'; fetch_remote
when 'update-head'; update_head when 'update-head'; update_head
when 'push-branches'; push_branches
when 'delete-remote-branches'; delete_remote_branches
when 'gc'; gc when 'gc'; gc
else else
$logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}." $logger.warn "Attempt to execute invalid gitlab-projects command #{@command.inspect}."
...@@ -71,6 +73,47 @@ class GitlabProjects ...@@ -71,6 +73,47 @@ class GitlabProjects
protected protected
def push_branches
remote_name = ARGV.shift
$logger.info "Pushing branches from #{full_path} to remote #{remote_name}: #{ARGV}"
cmd = %W(git --git-dir=#{full_path} push --tags -- #{remote_name}).concat(ARGV)
pid = Process.spawn(*cmd)
begin
Process.wait(pid)
$?.exitstatus.zero?
rescue => exception
$logger.error "Pushing branches to remote #{remote_name} failed due to: #{exception.message}"
Process.kill('KILL', pid)
Process.wait
false
end
end
def delete_remote_branches
remote_name = ARGV.shift
branches = ARGV.map { |branch_name| ":#{branch_name}" }
$logger.info "Pushing deleted branches from #{full_path} to remote #{remote_name}: #{ARGV}"
cmd = %W(git --git-dir=#{full_path} push -- #{remote_name}).concat(branches)
pid = Process.spawn(*cmd)
begin
Process.wait(pid)
$?.exitstatus.zero?
rescue => exception
$logger.error "Pushing deleted branches to remote #{remote_name} failed due to: #{exception.message}"
Process.kill('KILL', pid)
Process.wait
false
end
end
def create_branch def create_branch
branch_name = ARGV.shift branch_name = ARGV.shift
ref = ARGV.shift || "HEAD" ref = ARGV.shift || "HEAD"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment