Class: PVN::Diff::ChangedPaths

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

Overview

represents both LogPaths and StatusPaths

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ ChangedPaths

Returns a new instance of ChangedPaths.



14
15
16
# File 'lib/pvn/diff/changed_paths.rb', line 14

def initialize paths
  @paths = paths
end

Instance Method Details

#diff_revision_to_working_copy(revision, whitespace) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pvn/diff/changed_paths.rb', line 18

def diff_revision_to_working_copy revision, whitespace
  fromrev = revision.from.value

  info "revision: #{revision}".cyan
  rev = PVN::Revision::Range.new revision.to_s, 'HEAD'
  info "rev: #{rev}".cyan

  logpaths = LogPaths.new rev, @paths
  name_to_logpath = logpaths.to_map

  statuspaths = StatusPaths.new revision, @paths
  name_to_statuspath = statuspaths.to_map

  ### $$$ log names and status names should have a Name class

  names = Set.new
  names.merge name_to_logpath.keys.collect { |name| name[1 .. -1] }
  info "names: #{names.inspect}"

  names.merge name_to_statuspath.keys
  info "names: #{names.inspect}"

  names.sort.each do |name|
    info "name: #{name}"

    ### $$$ silliness because I don't have Diff::Name integrated:
    logname = '/' + name
    
    logpath = name_to_logpath[logname]
    info "logpaths: #{logpaths}"

    stpath = name_to_statuspath[name]
    info "stpath: #{stpath}"

    frrev = nil

    if logpath
      chgrevs = logpath.revisions_later_than fromrev
      logpath.diff_revision_to_working_copy revision, whitespace
    else
      # it's a local file only
      stpath.show_diff whitespace
    end
  end
end