Parent

Included Modules

Files

RSCM::Revision

Represents a collection of RevisionFile that were committed at the same time, or “more or less at the same time” for non-atomic SCMs (such as CVS and StarTeam). See Revisions for how to emulate atomicity for non-atomic SCMs.

Attributes

developer[RW]
identifier[W]
message[RW]

Public Class Methods

new(identifier=nil, time=nil) click to toggle source
# File lib/rscm/revision.rb, line 17
def initialize(identifier=nil, time=nil)
  @identifier = identifier
  @time = time
  @files = []
end

Public Instance Methods

==(other) click to toggle source
# File lib/rscm/revision.rb, line 63
def ==(other)
  self.to_s == other.to_s
end
[](n) click to toggle source
# File lib/rscm/revision.rb, line 86
def [](n)
  @files[n]
end
add(file) click to toggle source
# File lib/rscm/revision.rb, line 23
def add(file)
  raise "Can't add #{file} to this revision" unless accept? file
  @files << file
  self.developer = file.developer if file.developer
  self.message = file.message if file.message
end
each(&block) click to toggle source
# File lib/rscm/revision.rb, line 82
def each(&block)
  @files.each(&block)
end
empty?() click to toggle source
# File lib/rscm/revision.rb, line 98
def empty?
  @files.empty?
end
identifier(min_or_max = :max) click to toggle source
# File lib/rscm/revision.rb, line 30
def identifier(min_or_max = :max)
  @identifier || time(min_or_max)
end
length() click to toggle source
# File lib/rscm/revision.rb, line 90
def length
  @files.length
end
pop() click to toggle source
# File lib/rscm/revision.rb, line 94
def pop
  @files.pop
end
time(min_or_max = :max) click to toggle source

The time of this revision. Depending on the value of min_or_max, (should be :min or :max), returns the min or max time of this revision. (min or max only matters for non-transactional scms)

# File lib/rscm/revision.rb, line 37
def time(min_or_max = :max)
  @time || self.collect{|file| file.time}.__send__(min_or_max)
end
time=(t) click to toggle source

Sets the time for this revision. Should only be used by atomic SCMs. Non-atomic SCMs should not invoke this method, but instead create revisions by adding RscmFile objects to a Revisions object.

# File lib/rscm/revision.rb, line 44
def time=(t)
  raise "time must be a Time object - it was a #{t.class.name} with the string value #{t}" unless t.is_a?(Time)
  raise "can't set time to an inferiour value than the previous value" if @time && (t < @time)
  @time = t
end
to_s() click to toggle source

String representation that can be used for debugging.

# File lib/rscm/revision.rb, line 68
def to_s
  if(@to_s.nil?)
    min = time(:min)
    max = time(:max)
    t = (min==max) ? min : "#{min}-#{max}"
    @to_s = "#{identifier} | #{developer} | #{t} | #{message}\n"
    self.each do |file|
      @to_s << " " << file.to_s << "\n"
    end
    @to_s
  end
  @to_s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.