Class: Papa::Command::Git::Merge

Inherits:
Base
  • Object
show all
Defined in:
lib/papa/command/git/merge.rb

Instance Attribute Summary

Attributes inherited from Base

#command, #exit_status, #silent, #stderr, #stdout

Instance Method Summary collapse

Methods inherited from Base

#failed?, #success?

Constructor Details

#initialize(branch_name) ⇒ Merge

Returns a new instance of Merge.



7
8
9
10
11
# File 'lib/papa/command/git/merge.rb', line 7

def initialize(branch_name)
  @branch_name = branch_name
  command = "git merge #{@branch_name} --no-ff"
  super(command)
end

Instance Method Details

#cleanupObject



18
19
20
21
22
23
24
25
# File 'lib/papa/command/git/merge.rb', line 18

def cleanup
  super
  require 'papa/command/git/merge_abort'
  require 'papa/command/git/checkout'

  Command::Git::MergeAbort.new.run
  Command::Git::Checkout.new(current_branch).run
end

#failure_messageObject



27
28
29
30
31
32
# File 'lib/papa/command/git/merge.rb', line 27

def failure_message
  super
  message = "Failed to merge #{@branch_name} into #{current_branch}. Merge conflict?"
  Helper::Output.error message
  message
end

#runObject



13
14
15
16
# File 'lib/papa/command/git/merge.rb', line 13

def run
  current_branch # Store current branch before executing command
  super
end