Class: Git::Branch
- Inherits:
-
Object
- Object
- Git::Branch
- Defined in:
- lib/git/status_all/git.rb
Instance Method Summary collapse
- #ahead ⇒ Object
- #ahead_count ⇒ Object
- #behind ⇒ Object
- #behind_count ⇒ Object
- #current? ⇒ Boolean
- #remotes(remote_name = nil) ⇒ Object
- #up_to_date? ⇒ Boolean
Instance Method Details
#ahead ⇒ Object
26 27 28 29 30 |
# File 'lib/git/status_all/git.rb', line 26 def ahead origin = self.remotes(:origin) return [] if origin.nil? @base.log.between(origin.full, self.name) end |
#ahead_count ⇒ Object
38 39 40 |
# File 'lib/git/status_all/git.rb', line 38 def ahead_count @ahead_count ||= ahead.count end |
#behind ⇒ Object
32 33 34 35 36 |
# File 'lib/git/status_all/git.rb', line 32 def behind origin = self.remotes(:origin) return [] if origin.nil? @base.log.between(self.name, origin.full) end |
#behind_count ⇒ Object
42 43 44 |
# File 'lib/git/status_all/git.rb', line 42 def behind_count @behind_count ||= behind.count end |
#current? ⇒ Boolean
18 19 20 |
# File 'lib/git/status_all/git.rb', line 18 def current? current end |
#remotes(remote_name = nil) ⇒ Object
46 47 48 49 50 |
# File 'lib/git/status_all/git.rb', line 46 def remotes(remote_name = nil) result = @base.branches.remote.select{|b| b.name == self.name } return result.select{|b| b.full.include? remote_name.to_s }.first unless remote_name.nil? return result end |
#up_to_date? ⇒ Boolean
22 23 24 |
# File 'lib/git/status_all/git.rb', line 22 def up_to_date? ahead_count == 0 && behind_count == 0 end |