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.
880 881 882 883 884 885 886 887 888 889 890 891 892 893 |
# File 'lib/autobuild/import/git.rb', line 880 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.
878 879 880 |
# File 'lib/autobuild/import/git.rb', line 878 def common_commit @common_commit end |
#fetch_commit ⇒ Object (readonly)
Returns the value of attribute fetch_commit.
878 879 880 |
# File 'lib/autobuild/import/git.rb', line 878 def fetch_commit @fetch_commit end |
#head_commit ⇒ Object (readonly)
Returns the value of attribute head_commit.
878 879 880 |
# File 'lib/autobuild/import/git.rb', line 878 def head_commit @head_commit end |
Instance Method Details
#log(package, from, to) ⇒ Object
899 900 901 902 903 904 905 906 |
# File 'lib/autobuild/import/git.rb', line 899 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
895 896 897 |
# File 'lib/autobuild/import/git.rb', line 895 def needs_update? status == Status::NEEDS_MERGE || status == Status::SIMPLE_UPDATE end |