class P4::Revision

*****************************************************************************

P4::Revision class
Each P4::Revision object holds details about a particular revision
of a file. It may also contain the history of any integrations
to/from the file

*****************************************************************************

Attributes

depot_file[R]
integrations[RW]

Public Class Methods

new( depotFile ) click to toggle source
# File lib/P4.rb, line 539
def initialize( depotFile )
  @depot_file = depotFile
  @integrations = Array.new
  @attributes = Hash.new
end

Public Instance Methods

each_integration() { |i| ... } click to toggle source
# File lib/P4.rb, line 554
def each_integration
  @integrations.each { |i| yield( i ) }
end
integration( how, file, srev, erev ) click to toggle source
# File lib/P4.rb, line 548
def integration( how, file, srev, erev )
  rec = P4::Integration.new( how, file, srev, erev )
  @integrations.push( rec )
  return rec
end
method_missing( m, *a ) click to toggle source

Generic getters and setters for revision attributes.

# File lib/P4.rb, line 581
def method_missing( m, *a )
  k = m.to_s.downcase
  if( k =~ /(.*)=$/ )
    if( a.length() == 0 )
      raise( P4Exception, "Method P4##{m} requires an argument" );
    end
    k = $1
    @attributes[ k ] = a.shift
  else
    @attributes[ k ]
  end
end
set_attribute( name, value ) click to toggle source
# File lib/P4.rb, line 558
def set_attribute( name, value )
  name = name.downcase
  if( value =~ /^\d+$/ )
    @attributes[ name ] = value.to_i
  else
    @attributes[ name ] = value
  end
end
type() click to toggle source

Define type and type= explicitly as they clash with the deprecated Object#type. As it is deprecated, this clash should disappear in time.

# File lib/P4.rb, line 570
def type
  @attributes[ 'type' ]
end
type=( t ) click to toggle source
# File lib/P4.rb, line 574
def type=( t )
  @attributes[ 'type' ] = t
end