class RSCM::RevisionFile
Represents a file within a Revision, and also information about how this file was modified compared with the previous revision.
Constants
- ADDED
- DELETED
- MODIFIED
- MOVED
Attributes
The developer who modified this file
The commit message for this file
The native SCM's revision for this file. For non-transactional SCMs this is different from the parent Revision's
Relative path from the root of the RSCM::Base instance
The native SCM's previous revision for this file. For non-transactional SCMs this is different from the parent Revision's
This is a UTC ruby time
Public Class Methods
# File lib/rscm/revision_file.rb, line 34 def initialize(path=nil, status=nil, developer=nil, message=nil, native_revision_identifier=nil, time=nil) @path, @developer, @message, @native_revision_identifier, @time, @status = path, developer, message, native_revision_identifier, time, status end
Public Instance Methods
# File lib/rscm/revision_file.rb, line 74 def ==(other) return false if !other.is_a?(self.class) self.status == other.status && self.path == other.path && self.developer == other.developer && self.message == other.message && self.native_revision_identifier == other.native_revision_identifier && self.time == other.time end
Accepts a visitor that must respond to +visit_file(revision_file)+
# File lib/rscm/revision_file.rb, line 65 def accept(visitor) visitor.visit_file(self) end
Yields the diff as an IO for this file
# File lib/rscm/revision_file.rb, line 54 def diff(scm, options={}, &block) from_to = case status when /#{RevisionFile::MODIFIED}/; [previous_native_revision_identifier, native_revision_identifier] when /#{RevisionFile::DELETED}/; [previous_native_revision_identifier, nil] when /#{RevisionFile::ADDED}/; [nil, native_revision_identifier] end scm.diff(path, from_to[0], from_to[1], options, &block) end
Returns/yields an IO containing the contents of this file, using the
scm
this file lives in.
# File lib/rscm/revision_file.rb, line 49 def open(scm, options={}, &block) #:yield: io scm.open(path, native_revision_identifier, options, &block) end
A simple string representation. Useful for debugging.
# File lib/rscm/revision_file.rb, line 70 def to_s "#{path} | #{native_revision_identifier}" end