Class: Git::StreamCommit
- Inherits:
-
Object
- Object
- Git::StreamCommit
- Defined in:
- lib/git/stream.rb
Overview
Stream Classes
These classes must support the following methods
to_s - write the command to the git protocol stream
Instance Attribute Summary collapse
-
#ancestor ⇒ Object
Returns the value of attribute ancestor.
-
#author ⇒ Object
Returns the value of attribute author.
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#changes ⇒ Object
Returns the value of attribute changes.
-
#committer ⇒ Object
Returns the value of attribute committer.
-
#mark ⇒ Object
Returns the value of attribute mark.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
- #copy_file(repos_path_from, repos_path_to) ⇒ Object
- #delete_all_files ⇒ Object
- #delete_file(repos_path) ⇒ Object
-
#initialize ⇒ StreamCommit
constructor
A new instance of StreamCommit.
- #modify_file(repos_path, data, mode = nil) ⇒ Object
- #rename_file(repos_path_from, repos_path_to) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ StreamCommit
Returns a new instance of StreamCommit.
18 19 20 21 22 23 24 25 26 |
# File 'lib/git/stream.rb', line 18 def initialize() @branch = nil @mark = StreamMark.new @author = nil @committer = nil @message = nil @ancestor = nil @changes = [] end |
Instance Attribute Details
#ancestor ⇒ Object
Returns the value of attribute ancestor.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def ancestor @ancestor end |
#author ⇒ Object
Returns the value of attribute author.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def @author end |
#branch ⇒ Object
Returns the value of attribute branch.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def branch @branch end |
#changes ⇒ Object
Returns the value of attribute changes.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def changes @changes end |
#committer ⇒ Object
Returns the value of attribute committer.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def committer @committer end |
#mark ⇒ Object
Returns the value of attribute mark.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def mark @mark end |
#message ⇒ Object
Returns the value of attribute message.
16 17 18 |
# File 'lib/git/stream.rb', line 16 def @message end |
Instance Method Details
#copy_file(repos_path_from, repos_path_to) ⇒ Object
42 43 44 |
# File 'lib/git/stream.rb', line 42 def copy_file(repos_path_from, repos_path_to) changes << StreamFileCopy.new(repos_path_form, repos_path_to) end |
#delete_all_files ⇒ Object
46 47 48 |
# File 'lib/git/stream.rb', line 46 def delete_all_files() changes << StreamFileDeleteAll.new end |
#delete_file(repos_path) ⇒ Object
34 35 36 |
# File 'lib/git/stream.rb', line 34 def delete_file(repos_path) changes << StreamFileDelete.new(repos_path) end |
#modify_file(repos_path, data, mode = nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/git/stream.rb', line 28 def modify_file(repos_path, data, mode = nil) sfm = StreamFileModify.new(repos_path, data) sfm.mode = mode unless mode == nil changes << sfm end |
#rename_file(repos_path_from, repos_path_to) ⇒ Object
38 39 40 |
# File 'lib/git/stream.rb', line 38 def rename_file(repos_path_from, repos_path_to) changes << StreamFileRename.new(repos_path_form, repos_path_to) end |
#to_s ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/git/stream.rb', line 50 def to_s out = "commit refs/heads/#{branch.to_s}\n" out << "mark #{mark}\n" out << "author #{.name} <#{.email}> #{.date.rfc2822}\n" unless == nil out << "committer #{committer.name} <#{committer.email}> #{committer.date.rfc2822}\n" unless committer == nil if ( == nil) out << StreamData.emit_empty_data else out << StreamData.emit_inline_data() end out << "from #{ancestor}\n" unless ancestor == nil changes.each do |c| out << c.to_s end out << "\n" end |