Class: Svn::Log::EntryStruct

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/svn/logs.rb

Overview

A subversion log entry

Instance Method Summary collapse

Instance Method Details

#authorObject

return the revision’s author



92
93
94
# File 'lib/svn/logs.rb', line 92

def author
  props[ AUTHOR_PROP_NAME ] if props
end

#changed_pathsObject

returns a Hash of the revision’s changed paths



72
73
74
75
76
77
78
# File 'lib/svn/logs.rb', line 72

def changed_paths
  @changed_paths ||= ( self[:changed_paths].null? ? nil :
      self[:changed_paths].to_h.tap { |by_path|
          by_path.each_key { |k| by_path[k] = by_path[k].to_h }
        }
    )
end

#has_children?Boolean

returns whether this revision has children

Returns:

  • (Boolean)


67
68
69
# File 'lib/svn/logs.rb', line 67

def has_children?
  ( self[:has_children] == 1 )
end

#messageObject Also known as: log

return the revision’s log message



86
87
88
# File 'lib/svn/logs.rb', line 86

def message
  props[ LOG_PROP_NAME ] if props
end

#propsObject

returns a Hash of the revision’s properties



81
82
83
# File 'lib/svn/logs.rb', line 81

def props
  @props ||= ( self[:rev_props].null? ? nil : self[:rev_props].to_h )
end

#revObject Also known as: num

returns the revision number



61
62
63
# File 'lib/svn/logs.rb', line 61

def rev
  self[:rev]
end

#timestampObject

return the Time that this revision was committed



97
98
99
# File 'lib/svn/logs.rb', line 97

def timestamp
  Time.parse( props[ TIMESTAMP_PROP_NAME ] ) if props
end

#to_hObject

get the contents of this log entry as a multi-level hash



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/svn/logs.rb', line 102

def to_h
  h = {
      :rev => rev,
      :log => message,
      :author => author,
      :timestamp => timestamp,
      :has_children? => has_children?,
    }
  h[:changed_paths] = changed_paths if changed_paths
  h
end