class XMigra::SvnHistoryTracer
Attributes
history[R]
most_recent_commit[R]
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 388 def initialize(path) @path = Pathname(path) info_doc = subversion(:info, path.to_s) @root_url = info_doc.elements['string(info/entry/repository/root)'] @most_recent_commit = info_doc.elements['string(info/entry/@revision)'].to_i @history = [] @next_query = [branch_identifier, @most_recent_commit] @history.unshift(@next_query.dup) end
Public Instance Methods
copying_element(log_doc)
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 445 def copying_element(log_doc) log_doc.each_element %Q{/log/logentry/paths/path[@copyfrom-path]} do |elt| return elt if elt.text == @next_query[0] return elt if @next_query[0].start_with? (elt.text + '/') end return nil end
earliest_loaded_pinned_url(rel_path=nil)
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 435 def earliest_loaded_pinned_url(rel_path=nil) pin_rev = @history[0][1] if rel_path.nil? [earliest_loaded_url, pin_rev.to_s].join('@') else rel_path = Pathname(rel_path) "#{earliest_loaded_url}/#{rel_path}@#{pin_rev}" end end
earliest_loaded_repopath()
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 423 def earliest_loaded_repopath history[0][0] end
earliest_loaded_revision()
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 431 def earliest_loaded_revision history[0][1] end
earliest_loaded_url()
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 427 def earliest_loaded_url @root_url + history[0][0] end
history_exhausted?()
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 419 def history_exhausted? @next_query[1] <= 0 end
load_parent_commit()
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 400 def load_parent_commit log_doc = next_earlier_log if copy_elt = copying_element(log_doc) trailing_part = branch_identifier[copy_elt.text.length..-1] @next_query = [ copy_elt.attributes['copyfrom-path'] + trailing_part, copy_elt.attributes['copyfrom-rev'].to_i ] @history.unshift(@next_query) @next_query.dup elsif change_elt = log_doc.elements['/log/logentry'] @next_query[1] = change_elt.attributes['revision'].to_i - 1 @next_query.dup if @next_query[1] > 0 else @next_query[1] -= 1 @next_query.dup if @next_query[1] > 0 end end
next_earlier_log()
click to toggle source
# File lib/xmigra/vcs_support/svn.rb, line 453 def next_earlier_log subversion(:log, '-l1', '-v', "-r#{@next_query[1]}:1", self.path) end