Class: PVN::Diff::LogPaths

Inherits:
Paths
  • Object
show all
Includes:
Logue::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



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

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



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

def add_path logentry, logentrypath, pathinfo
  info "logentry: #{logentry}".color('#fa3d3d')

  name = logentrypath.name
  revision = logentry.revision
  action = logentrypath.action
  info "action: #{action}"
  url = pathinfo.url

  info "action: #{action}".color('#fa3d3d')
  info "url: #{url}"
  
  path = @elements.detect { |element| element.name == name }
  if path
    info "path: #{path}"
    path.add_change revision, action
  else
    path = LogPath.new(name, revision, action, url)
    info "path: #{path}"
    @elements << path
  end
end

#diff_revision_to_revision(revision, whitespace) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/pvn/diff/log_paths.rb', line 51

def diff_revision_to_revision revision, whitespace
  name_to_logpath = to_map

  name_to_logpath.sort.each do |name, logpath|
    if logpath.is_revision_later_than? revision.from.value
      logpath.diff_revision_to_revision revision, whitespace
    end
  end
end