Class: Nabokov::Merger

Inherits:
Object
  • Object
show all
Defined in:
lib/nabokov/helpers/merger.rb

Overview

Class is responsible for merging two branches

Instance Method Summary collapse

Constructor Details

#initialize(informator, git_repo, rescue_commit_sha = nil) ⇒ Merger

Returns a new instance of Merger.



13
14
15
16
17
18
19
# File 'lib/nabokov/helpers/merger.rb', line 13

def initialize(informator, git_repo, rescue_commit_sha = nil)
  raise "'informator' is a required parameter" if informator.nil?
  raise "'git_repo' is a required parameter" if git_repo.nil?
  @rescue_commit_sha = rescue_commit_sha
  @git_repo = git_repo
  @informator = informator
end

Instance Method Details

#merge(head, branch) ⇒ Object

Merges one branch with another branch It handles the situation when there are merge conflicts and provides

the interface to the user to resolve the conflicts


24
25
26
27
28
29
# File 'lib/nabokov/helpers/merger.rb', line 24

def merge(head, branch)
  @git_repo.merge_branches(head, branch)
  MergerResult::SUCCEEDED
rescue Git::GitExecuteError
  rescue_merge
end