Parent

Files

RSCM::RevisionFile

Represents a file within a Revision, and also information about how this file was modified compared with the previous revision.

Attributes

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]
time[RW]

This is a UTC ruby time

Public Class Methods

new(path=nil, status=nil, developer=nil, message=nil, native_revision_identifier=nil, time=nil) click to toggle source
# 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

==(other) click to toggle source
# 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
accept(visitor) click to toggle source

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
diff(scm, options={}, &block) click to toggle source

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
open(scm, options={}) click to toggle source

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
to_s() click to toggle source

A simple string representation. Useful for debugging.

# File lib/rscm/revision_file.rb, line 70
def to_s
  "#{path} | #{native_revision_identifier}"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.