Class: Papa::Command::Git::Rebase

Inherits:
Base
  • Object
show all
Defined in:
lib/papa/command/git/rebase.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(base_branch_name) ⇒ Rebase

Returns a new instance of Rebase.



9
10
11
12
13
# File 'lib/papa/command/git/rebase.rb', line 9

def initialize(base_branch_name)
  @base_branch_name = base_branch_name
  command = "git rebase #{@base_branch_name}"
  super(command)
end

Instance Method Details

#cleanupObject



20
21
22
23
24
25
26
27
28
# File 'lib/papa/command/git/rebase.rb', line 20

def cleanup
  super
  queue = [
    Git::RebaseAbort.new,
    Git::Checkout.new(current_branch)
  ]
  runner = Runner.new(queue)
  runner.run
end

#failure_messageObject



30
31
32
33
34
35
# File 'lib/papa/command/git/rebase.rb', line 30

def failure_message
  super
  message = "Failed to rebase #{current_branch} from #{@base_branch_name}. Merge conflict?"
  Helper::Output.error message
  message
end

#runObject



15
16
17
18
# File 'lib/papa/command/git/rebase.rb', line 15

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