Class: RSCM::SubversionLogParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rscm/scm/subversion_log_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, url, exclude_below = nil) ⇒ SubversionLogParser

Returns a new instance of SubversionLogParser.



7
8
9
10
11
# File 'lib/rscm/scm/subversion_log_parser.rb', line 7

def initialize(io, url, exclude_below=nil)
  @io = io
  @revision_parser = SubversionLogEntryParser.new(url)
  @exclude_below = exclude_below
end

Instance Method Details

#parse_revisions(&line_proc) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rscm/scm/subversion_log_parser.rb', line 13

def parse_revisions(&line_proc)
  # skip over the first ------
  @revision_parser.parse(@io, true, &line_proc)
  revisions = Revisions.new
  while(!@io.eof?)
    revision = @revision_parser.parse(@io, &line_proc)
    if(revision)
      # Filter out the lower bound to avoid inclusiveness of the lower bound (see contract)
      # We're doing this instead of increasing the from_identifer with 1, since that causes an error.
      exclude = false
      if(@exclude_below.is_a? Time)
        exclude = revision.time <= @exclude_below
      elsif(@exclude_below.is_a? Numeric)
        exclude = revision.identifier <= @exclude_below
      end
      revisions.add(revision) unless exclude
    end
  end
  revisions
end