Class: SubversionConnection

Inherits:
Object
  • Object
show all
Defined in:
app/reporters/svn_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings = SubversionSettingsProvider.new, runner = Runner.new) ⇒ SubversionConnection

Returns a new instance of SubversionConnection.



23
24
25
26
27
# File 'app/reporters/svn_connection.rb', line 23

def initialize(settings=SubversionSettingsProvider.new, runner=Runner.new)
  @settings = settings
  @runner = FixedParameterRunner.new(runner, "t\n", 'LC_MESSAGES' => 'C')
  @diff_cache = Hash.new
end

Instance Method Details

#diff(rev_id) ⇒ Object



44
45
46
# File 'app/reporters/svn_connection.rb', line 44

def diff(rev_id)
  @diff_cache[rev_id] ||= svn("diff #{@settings.repo_url} -r#{rev_id.to_i - 1}:#{rev_id}")
end

#info(path, rev_id) ⇒ Object



48
49
50
# File 'app/reporters/svn_connection.rb', line 48

def info(path, rev_id)
  svn("info -r#{rev_id} --xml #{@settings.repo_url}#{path}")
end

#log(options = {:history_from => 'r0'}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/reporters/svn_connection.rb', line 29

def log(options={:history_from => 'r0'})
  command = "log #{@settings.repo_url} -v"

  if options.respond_to? :[]
    if options[:history_from]
      r = options[:history_from]
      command += " -rHEAD:#{r[1..r.length].succ} --limit=#{@settings.package_size}"
    elsif options[:only]
      command += " -r#{options[:only].to_s}"
    end
  end
  
  svn(command)
end