Class: Repository::Divergence
- Inherits:
-
Object
- Object
- Repository::Divergence
- Defined in:
- lib/repository/divergence.rb
Instance Attribute Summary collapse
-
#ahead ⇒ Object
readonly
Returns the value of attribute ahead.
-
#behind ⇒ Object
readonly
Returns the value of attribute behind.
-
#upstream ⇒ Object
readonly
Returns the value of attribute upstream.
Instance Method Summary collapse
-
#initialize(repo, ref) ⇒ Divergence
constructor
A new instance of Divergence.
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
#ahead ⇒ Object (readonly)
Returns the value of attribute ahead.
6 7 8 |
# File 'lib/repository/divergence.rb', line 6 def ahead @ahead end |
#behind ⇒ Object (readonly)
Returns the value of attribute behind.
6 7 8 |
# File 'lib/repository/divergence.rb', line 6 def behind @behind end |
#upstream ⇒ Object (readonly)
Returns the value of attribute upstream.
6 7 8 |
# File 'lib/repository/divergence.rb', line 6 def upstream @upstream end |