Class: Geet::Services::MergePr

Inherits:
Object
  • Object
show all
Defined in:
lib/geet/services/merge_pr.rb

Overview

Merges the PR for the current branch.

The workflow of this services is oriented to the a commondline usage: the user doesn’t need to lookup the merge for the working branch; this comes at the cost of extra operations and constraints, but speeds up the workflow.

Constant Summary collapse

DEFAULT_GIT_CLIENT =
Geet::Utils::GitClient.new

Instance Method Summary collapse

Constructor Details

#initialize(repository, out: $stdout, git_client: DEFAULT_GIT_CLIENT) ⇒ MergePr

Returns a new instance of MergePr.



14
15
16
17
18
# File 'lib/geet/services/merge_pr.rb', line 14

def initialize(repository, out: $stdout, git_client: DEFAULT_GIT_CLIENT)
  @repository = repository
  @out = out
  @git_client = git_client
end

Instance Method Details

#execute(delete_branch: false) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/geet/services/merge_pr.rb', line 20

def execute(delete_branch: false)
  merge_head = find_merge_head
  pr = checked_find_branch_pr(merge_head)
  merge_pr(pr)
  do_delete_branch if delete_branch
  pr
end