Class: PVN::Diff::RepositoryDiffer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ RepositoryDiffer

Returns a new instance of RepositoryDiffer.



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

def initialize options
  super
  
  paths = options.paths
  paths = %w{ . } if paths.empty?

  info "paths: #{paths}"

  # we sort only the sub-entries, so the order in which paths were specified is preserved

  rev = options.revision
  change = options.change

  # this is for getting revisions only later than the given revision
  # (argument); this only handling revision numbers (not dates) for now.

  rev = change ? [ change.to_i - 1, change.to_i ] : options.revision
  info "rev: #{rev}"
  @revision = PVN::Revision::Range.new(*rev)
  info "@revision: #{@revision}"

  # this indicates that this should be split into two classes:
  if @revision.working_copy?
    chgpaths = ChangedPaths.new paths
    chgpaths.diff_revision_to_working_copy @revision, @whitespace
  else
    logpaths = LogPaths.new @revision, paths
    logpaths.diff_revision_to_revision @revision, @whitespace
  end
end

Instance Attribute Details

#revisionObject (readonly)

Returns the value of attribute revision.



16
17
18
# File 'lib/pvn/diff/repository_differ.rb', line 16

def revision
  @revision
end

#whitespaceObject (readonly)

Returns the value of attribute whitespace.



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

def whitespace
  @whitespace
end