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.
# File lib/rscm/revision.rb, line 63 def ==(other) self.to_s == other.to_s end
# 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
# File lib/rscm/revision.rb, line 82 def each(&block) @files.each(&block) end
# File lib/rscm/revision.rb, line 30 def identifier(min_or_max = :max) @identifier || time(min_or_max) end
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
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
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
Generated with the Darkfish Rdoc Generator 2.