Class: PVN::Pct::RepositoryDiffer
- Defined in:
- lib/pvn/pct/repository_differ.rb
Instance Method Summary collapse
- #get_diff_counts(path, options) ⇒ Object
-
#get_from_to_revisions(rev) ⇒ Object
$$$ this belongs in Revision.
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
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 63 64 65 66 67 68 |
# File 'lib/pvn/pct/repository_differ.rb', line 27 def get_diff_counts path, diff_counts = Array.new revision = .revision elmt = PVN::IO::Element.new :local => path modified = elmt.find_modified_entries revision modnames = modified.collect { |m| m.name }.sort.uniq fromrev, torev = get_from_to_revisions revision reporoot = elmt.repo_root direlmt = PVN::IO::Element.new :local => '.' svninfo = direlmt.get_info filter = svninfo.url.dup filter.slice! svninfo.root info "filter: #{filter}" filterre = Regexp.new '^' + filter + '/' modnames.each do |mod| fullpath = reporoot + mod elmt = PVN::IO::Element.new :path => fullpath next unless elmt.has_revision? fromrev next unless elmt.has_revision? torev next if elmt.get_info.kind == 'dir' from_count = elmt.cat(fromrev).size to_count = elmt.cat(torev).size name = mod.dup name.slice! filterre dc = PVN::DiffCount.new from_count, to_count, name diff_counts << dc end diff_counts end |
#get_from_to_revisions(rev) ⇒ Object
$$$ this belongs in Revision
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pvn/pct/repository_differ.rb', line 11 def get_from_to_revisions rev if rev.kind_of? Array if rev.size == 1 if md = Regexp.new('(.+):(.+)').match(rev[0]) return [ md[1], md[2] ] else return [ (rev[0].to_i - 1).to_s, rev[0] ] end else return [ rev[0], rev[1] ] end else info "rev: #{rev}".bold.white.on_red end end |