30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/routes/git_push.rb', line 30
def git_push
@git.check_for_same_branch(App::Git::SAME_BRANCH_WARNING)
branch_code = @git.current_branch_for_repo(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE))
branch_db = @git.current_branch_for_repo(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB))
branches_to_push = []
branches_to_push << "#{App::Terminal::format_directory(@git.get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE)))} will push #{App::Terminal::format_branch(branch_code)} \xe2\x86\x92 #{App::Terminal::format_branch("origin/#{branch_code}")}" unless branch_code == App::Git::MASTER
branches_to_push << "#{App::Terminal::format_directory(@git.get_repo_shorthand(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_DB)))} will push #{App::Terminal::format_branch(branch_db)} \xe2\x86\x92 #{App::Terminal::format_branch("origin/#{branch_db}")}" unless branch_db == App::Git::MASTER
unless branches_to_push.any?
App::Terminal::error("#{App::Terminal::format_action('pushing')} to #{App::Terminal::format_branch(App::Git::MASTER)} is best done manually.", nil, true)
end
if App::Terminal::prompt_yes_no("#{App::Terminal::format_action('push')} the following repos:", branches_to_push)
@git.check_for_uncommitted_files(true)
@git.repo_loop.each do |repo_dir|
current_branch = @git.current_branch_for_repo(repo_dir)
if current_branch != App::Git::MASTER
unless App::Terminal::command_capture("git push origin #{current_branch}", repo_dir)
App::Terminal::warning('Something went wrong', "Not sure what the reason was, but doing a #{App::Terminal::format_command('git push')} on #{App::Terminal::format_directory(@git.get_repo_shorthand(repo_dir))} was unsuccessful.")
end
end
end
@git.check_for_stash(true)
end
end
|