Class: Repository::Divergence

Inherits:
Object
  • Object
show all
Defined in:
lib/repository/divergence.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo, ref) ⇒ Divergence

Returns a new instance of Divergence.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/repository/divergence.rb', line 8

def initialize(repo, ref)
  @upstream = repo.remotes.get_upstream(ref.short_name)
  return unless @upstream

  left   = ref.read_oid
  right  = repo.refs.read_ref(@upstream)
  common = Merge::CommonAncestors.new(repo.database, left, [right])

  common.find
  @ahead, @behind = common.counts
end

Instance Attribute Details

#aheadObject (readonly)

Returns the value of attribute ahead.



6
7
8
# File 'lib/repository/divergence.rb', line 6

def ahead
  @ahead
end

#behindObject (readonly)

Returns the value of attribute behind.



6
7
8
# File 'lib/repository/divergence.rb', line 6

def behind
  @behind
end

#upstreamObject (readonly)

Returns the value of attribute upstream.



6
7
8
# File 'lib/repository/divergence.rb', line 6

def upstream
  @upstream
end