Class: PVN::Pct::LocalDiffer

Inherits:
Differ
  • Object
show all
Defined in:
lib/pvn/pct/local_differ.rb

Instance Method Summary collapse

Methods inherited from Differ

#initialize, #show_diff_counts

Constructor Details

This class inherits a constructor from PVN::Pct::Differ

Instance Method Details

#get_diff_counts(path, options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pvn/pct/local_differ.rb', line 9

def get_diff_counts path, options
  elmt = PVN::IO::Element.new :local => path
  modified = elmt.find_files_by_status :modified
  info "modified: #{modified}".color('#fa4434')
  
  # total = PVN::DiffCount.new

  modified = modified.sort_by { |n| n.path }

  diff_counts = Array.new

  modified.each do |entry|
    info "entry.path: #{entry.path}".color('#fa4434')
    catexec = SVNx::CatExec.new path: entry.path, revision: nil, use_cache: false
    svn_count = catexec.output.size
    local_count = Pathname.new(entry.path).readlines.size
    
    dc = PVN::DiffCount.new svn_count, local_count, entry.path
    diff_counts << dc
  end

  diff_counts
end