Class: FlashFlow::BranchMerger

Inherits:
Object
  • Object
show all
Defined in:
lib/flash_flow/branch_merger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(git, branch) ⇒ BranchMerger

Returns a new instance of BranchMerger.



6
7
8
9
# File 'lib/flash_flow/branch_merger.rb', line 6

def initialize(git, branch)
  @git = git
  @branch = branch
end

Instance Attribute Details

#conflict_shaObject (readonly)

Returns the value of attribute conflict_sha.



4
5
6
# File 'lib/flash_flow/branch_merger.rb', line 4

def conflict_sha
  @conflict_sha
end

#resolutionsObject (readonly)

Returns the value of attribute resolutions.



4
5
6
# File 'lib/flash_flow/branch_merger.rb', line 4

def resolutions
  @resolutions
end

#resultObject (readonly)

Returns the value of attribute result.



4
5
6
# File 'lib/flash_flow/branch_merger.rb', line 4

def result
  @result
end

Instance Method Details

#do_merge(rerere_forget) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/flash_flow/branch_merger.rb', line 11

def do_merge(rerere_forget)
  if sha.nil?
    @result = :deleted
    return
  end

  @git.run("merge --no-ff #{@git.remote}/#{@branch.ref}")

  if @git.last_success? || try_rerere(rerere_forget)
    @result = :success
  else
    @conflict_sha = merge_rollback
    @result = :conflict
  end
end

#shaObject



27
28
29
30
# File 'lib/flash_flow/branch_merger.rb', line 27

def sha
  @sha if defined?(@sha)
  @sha = get_sha
end