| Class | RSCM::RevisionFile |
| In: |
lib/rscm/revision_file.rb
|
| Parent: | Object |
Represents a file within a Revision, and also information about how this file was modified compared with the previous revision.
| MODIFIED | = | "MODIFIED" |
| DELETED | = | "DELETED" |
| ADDED | = | "ADDED" |
| MOVED | = | "MOVED" |
| developer | [RW] | The developer who modified this file |
| message | [RW] | The commit message for this file |
| native_revision_identifier | [RW] | The native SCM’s revision for this file. For non-transactional SCMs this is different from the parent Revision’s |
| path | [RW] | Relative path from the root of the RSCM::Base instance |
| previous_native_revision_identifier | [RW] | The native SCM’s previous revision for this file. For non-transactional SCMs this is different from the parent Revision’s |
| status | [RW] | MODIFIED, DELETED, ADDED or MOVED |
| time | [RW] | This is a UTC ruby time |
# File lib/rscm/revision_file.rb, line 34
34: def initialize(path=nil, status=nil, developer=nil, message=nil, native_revision_identifier=nil, time=nil)
35: @path, @developer, @message, @native_revision_identifier, @time, @status = path, developer, message, native_revision_identifier, time, status
36: end
# File lib/rscm/revision_file.rb, line 74
74: def ==(other)
75: return false if !other.is_a?(self.class)
76: self.status == other.status &&
77: self.path == other.path &&
78: self.developer == other.developer &&
79: self.message == other.message &&
80: self.native_revision_identifier == other.native_revision_identifier &&
81: self.time == other.time
82: end
Accepts a visitor that must respond to +visit_file(revision_file)+
# File lib/rscm/revision_file.rb, line 65
65: def accept(visitor)
66: visitor.visit_file(self)
67: end
Yields the diff as an IO for this file
# File lib/rscm/revision_file.rb, line 54
54: def diff(scm, options={}, &block)
55: from_to = case status
56: when /#{RevisionFile::MODIFIED}/; [previous_native_revision_identifier, native_revision_identifier]
57: when /#{RevisionFile::DELETED}/; [previous_native_revision_identifier, nil]
58: when /#{RevisionFile::ADDED}/; [nil, native_revision_identifier]
59: end
60:
61: scm.diff(path, from_to[0], from_to[1], options, &block)
62: end