Class: PVN::Diff::RevisionRange

Inherits:
Revision::Range show all
Includes:
Comparable, Loggable
Defined in:
lib/pvn/diff/revision.rb

Instance Attribute Summary

Attributes inherited from Revision::Range

#from, #to

Instance Method Summary collapse

Methods inherited from Revision::Range

#head?, #to_revision, #to_s, #working_copy?

Constructor Details

#initialize(change, rev) ⇒ RevisionRange

Returns a new instance of RevisionRange.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pvn/diff/revision.rb', line 10

def initialize change, rev
  if change
    super change.to_i - 1, change.to_i
  elsif rev.kind_of? Array
    if rev.size == 2
      # this is some contorting, since -rx:y does not mean comparing the files
      # in changelist x; it means all the entries from x+1 through y, inclusive.

      super rev[0].to_i, rev[1].to_i
    else
      from, to = rev[0].split(':')
      info "from: #{from}"
      info "to  : #{to}".cyan
      super from, to
    end
  else
    raise "revision argument not handled: #{rev}"
  end
end

Instance Method Details

#<=>(other) ⇒ Object



30
31
32
33
34
# File 'lib/pvn/diff/revision.rb', line 30

def <=> other
  info "other: #{other}".yellow
  info "self: #{self}".yellow
  nil
end