Class: PVN::Diff::ChangedPaths

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



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

def initialize paths
  @paths = paths
end

Instance Method Details

#diff_revision_to_working_copy(revision, whitespace) ⇒ Object



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
# File 'lib/pvn/diff/changed_paths.rb', line 19

def diff_revision_to_working_copy revision, whitespace
  info "revision: #{revision}"
  rev = SVNx::Revision::Range.new revision.to_s, 'HEAD'
  info "rev: #{rev}"

  logpaths = LogPaths.new rev, @paths
  info "logpaths: #{logpaths}"
  name_to_logpath = logpaths.to_map
  info "name_to_logpath: #{name_to_logpath}"

  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]
    stpath = name_to_statuspath[name]
    
    # 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