Class: Autobuild::Git::Status
- Inherits:
-
Importer::Status
- Object
- Importer::Status
- Autobuild::Git::Status
- Defined in:
- lib/autobuild/import/git.rb
Overview
A Importer::Status object extended to store more git-specific information
This is the value returned by #status
Constant Summary
Constants inherited from Importer::Status
Importer::Status::ADVANCED, Importer::Status::NEEDS_MERGE, Importer::Status::SIMPLE_UPDATE, Importer::Status::UP_TO_DATE
Instance Attribute Summary collapse
-
#common_commit ⇒ Object
readonly
Returns the value of attribute common_commit.
-
#fetch_commit ⇒ Object
readonly
Returns the value of attribute fetch_commit.
-
#head_commit ⇒ Object
readonly
Returns the value of attribute head_commit.
Attributes inherited from Importer::Status
#local_commits, #remote_commits, #status, #uncommitted_code, #unexpected_working_copy_state
Instance Method Summary collapse
-
#initialize(package, status, remote_commit, local_commit, common_commit) ⇒ Status
constructor
A new instance of Status.
- #log(package, from, to) ⇒ Object
- #needs_update? ⇒ Boolean
Constructor Details
#initialize(package, status, remote_commit, local_commit, common_commit) ⇒ Status
Returns a new instance of Status.
826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
# File 'lib/autobuild/import/git.rb', line 826 def initialize(package, status, remote_commit, local_commit, common_commit) super() @status = status @fetch_commit = fetch_commit @head_commit = head_commit @common_commit = common_commit if remote_commit != common_commit @remote_commits = log(package, common_commit, remote_commit) end if local_commit != common_commit @local_commits = log(package, common_commit, local_commit) end end |
Instance Attribute Details
#common_commit ⇒ Object (readonly)
Returns the value of attribute common_commit.
824 825 826 |
# File 'lib/autobuild/import/git.rb', line 824 def common_commit @common_commit end |
#fetch_commit ⇒ Object (readonly)
Returns the value of attribute fetch_commit.
824 825 826 |
# File 'lib/autobuild/import/git.rb', line 824 def fetch_commit @fetch_commit end |
#head_commit ⇒ Object (readonly)
Returns the value of attribute head_commit.
824 825 826 |
# File 'lib/autobuild/import/git.rb', line 824 def head_commit @head_commit end |
Instance Method Details
#log(package, from, to) ⇒ Object
845 846 847 848 849 850 851 852 |
# File 'lib/autobuild/import/git.rb', line 845 def log(package, from, to) log = package.importer.( package, 'log', '--encoding=UTF-8', "--pretty=format:%h %cr %cn %s", "#{from}..#{to}") log.map do |line| line.strip.encode end end |
#needs_update? ⇒ Boolean
841 842 843 |
# File 'lib/autobuild/import/git.rb', line 841 def needs_update? status == Status::NEEDS_MERGE || status == Status::SIMPLE_UPDATE end |