Class: PVN::Diff::LogPaths

Inherits:
Paths
  • Object
show all
Includes:
Loggable
Defined in:
lib/pvn/diff/log_paths.rb

Overview

represents the log entries from one revision through another.

Instance Method Summary collapse

Methods inherited from Paths

#[], #each, #initialize, #size, #to_map

Constructor Details

This class inherits a constructor from PVN::Diff::Paths

Instance Method Details

#add_for_path(path) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pvn/diff/log_paths.rb', line 13

def add_for_path path
  pathelmt = PVN::IO::Element.new :local => path
  pathinfo = pathelmt.get_info
  elmt = PVN::IO::Element.new :local => path
  logentries = elmt.logentries @revision

  logentries.each do |logentry|
    logentry.paths.each do |logentrypath|
      next if logentrypath.kind != 'file'
      add_path logentry, logentrypath, pathinfo
    end 
  end
end

#add_path(logentry, logentrypath, pathinfo) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/pvn/diff/log_paths.rb', line 27

def add_path logentry, logentrypath, pathinfo
  name = logentrypath.name
  revision = logentry.revision
  action = logentrypath.action
  url = pathinfo.url

  info "action: #{action}".blue
  
  path = @elements.detect { |element| element.name == name }
  if path
    info "path: #{path}".on_blue
    path.add_revision logentry.revision, action
  else
    path = Path.new(name, logentry.revision, action, url)
    info "path: #{path}".on_cyan
    @elements << path
  end
end