Class: RSCM::SubversionLogEntryParser

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

Constant Summary collapse

STATES =
{"M" => RevisionFile::MODIFIED, "A" => RevisionFile::ADDED, "D" => RevisionFile::DELETED}

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ SubversionLogEntryParser

Returns a new instance of SubversionLogEntryParser.



28
29
30
31
# File 'lib/rscm/scm/subversion_log_parser.rb', line 28

def initialize(url)
  super(/^------------------------------------------------------------------------/)
  @url = url
end

Instance Method Details

#parse(io, skip_line_parsing = false, &line_proc) ⇒ Object



33
34
35
36
37
38
# File 'lib/rscm/scm/subversion_log_parser.rb', line 33

def parse(io, skip_line_parsing=false, &line_proc)
  # We have to trim off the last newline - it's not meant to be part of the message

  revision = super
  revision.message = revision.message[0..-2] if revision
  revision
end

#relative_path(url, repo_path) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rscm/scm/subversion_log_parser.rb', line 40

def relative_path(url, repo_path)
  url_tokens = url.split('/')
  repo_path_tokens = repo_path.split('/')
  
  max_similar = repo_path_tokens.length
  while(max_similar > 0)
    url = url_tokens[-max_similar..-1]
    path = repo_path_tokens[0..max_similar-1]
    if(url == path)
      break
    end
    max_similar -= 1
  end
  if(max_similar == 0) 
    nil
  else
    repo_path_tokens[max_similar..-1].join("/")
  end
end