Class: Svn::Log::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/svnlog/log.rb

Overview

An svn log

Instance Method Summary collapse

Constructor Details

#initialize(repository_url) ⇒ Log

Returns a new instance of Log.



9
10
11
# File 'lib/svnlog/log.rb', line 9

def initialize(repository_url)
  @repository_url = repository_url
end

Instance Method Details

#entriesObject

Returns all entries



14
15
16
# File 'lib/svnlog/log.rb', line 14

def entries
  find("1:HEAD")
end

#find(revision) ⇒ Object Also known as: []

Returns entries that match the specified revision (which can be a range)



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/svnlog/log.rb', line 19

def find(revision)
  entries = []
  doc = REXML::Document.new(`svn log \"#{@repository_url}\" --revision #{revision} --xml`)
  doc.elements.each('/log/logentry') do |element|
    entry = {}
    entry[:revision] = element.attribute('revision').value
    entry[:author] = element.text('author')
    entry[:message] = element.text('msg')
    entry[:date] = element.text('date')
    entries << entry
  end
  entries
end