Module: Eternity::Patch::Common

Included in:
Diff, Merge
Defined in:
lib/eternity/patch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_commitObject (readonly)

Returns the value of attribute current_commit.



14
15
16
# File 'lib/eternity/patch.rb', line 14

def current_commit
  @current_commit
end

#target_commitObject (readonly)

Returns the value of attribute target_commit.



14
15
16
# File 'lib/eternity/patch.rb', line 14

def target_commit
  @target_commit
end

Instance Method Details

#base_commitObject



21
22
23
# File 'lib/eternity/patch.rb', line 21

def base_commit
  @base_commit ||= Commit.base_of current_commit, target_commit
end

#base_historyObject



29
30
31
# File 'lib/eternity/patch.rb', line 29

def base_history
  @base_history ||= [base_commit] + base_commit.history
end

#current_historyObject



33
34
35
# File 'lib/eternity/patch.rb', line 33

def current_history
  @current_history ||= [current_commit] + current_commit.history - base_history
end

#deltaObject



25
26
27
# File 'lib/eternity/patch.rb', line 25

def delta
  @delta ||= TransparentProxy.new { calculate_delta }
end

#initialize(current_commit, target_commit) ⇒ Object



16
17
18
19
# File 'lib/eternity/patch.rb', line 16

def initialize(current_commit, target_commit)
  @current_commit = current_commit
  @target_commit = target_commit
end

#remaining_historyObject



41
42
43
# File 'lib/eternity/patch.rb', line 41

def remaining_history
  @remaining_history ||= current_history - target_history
end

#target_historyObject



37
38
39
# File 'lib/eternity/patch.rb', line 37

def target_history
  @target_history ||= [target_commit] + target_commit.history - base_history
end