lib/gitx/cli/integrate_command.rb in gitx-2.21.3 vs lib/gitx/cli/integrate_command.rb in gitx-2.21.4.ci.145.1

- old
+ new

@@ -14,16 +14,11 @@ assert_aggregate_branch!(integration_branch) branch = feature_branch_name print_message(branch, integration_branch) - begin - execute_command(UpdateCommand, :update) - rescue - raise MergeError, 'Merge conflict occurred. Please fix merge conflict and rerun the integrate command' - end - + run_git_cmd 'update' pull_request = pull_request_for_branch(branch) integrate_branch(branch, integration_branch, pull_request) unless options[:resume] checkout_branch branch end @@ -45,15 +40,15 @@ def integrate_branch(branch, integration_branch, pull_request) fetch_remote_branch(integration_branch) commit_message = "[gitx] Integrating #{branch} into #{integration_branch}" commit_message += " (Pull request ##{pull_request.number})" if pull_request begin - run_cmd %Q(git merge --no-ff -m "#{commit_message}" #{branch}) + run_git_cmd 'merge', '--no-ff', '--message', commit_message, branch rescue raise MergeError, "Merge conflict occurred. Please fix merge conflict and rerun command with --resume #{branch} flag" end - run_cmd 'git push origin HEAD' + run_git_cmd 'push', 'origin', 'HEAD' end def feature_branch_name @feature_branch ||= begin feature_branch = options[:resume] || current_branch.name @@ -65,12 +60,12 @@ end # nuke local branch and pull fresh version from remote repo def fetch_remote_branch(target_branch) create_remote_branch(target_branch) unless remote_branch_exists?(target_branch) - run_cmd 'git fetch origin' - run_cmd "git branch -D #{target_branch}", allow_failure: true + run_git_cmd 'fetch', 'origin' + run_git_cmd('branch', '--delete', '--force', target_branch) rescue Gitx::Executor::ExecutionError checkout_branch target_branch end def local_branch_exists?(branch) local_branches.include?(branch) @@ -84,10 +79,10 @@ repo.branches.each_name(:remote).include?("origin/#{target_branch}") end def create_remote_branch(target_branch) repo.create_branch(target_branch, config.base_branch) - run_cmd "git push origin #{target_branch}:#{target_branch}" + run_git_cmd 'push', 'origin', "#{target_branch}:#{target_branch}" end end end end