Class: XMigra::SvnHistoryTracer
Constant Summary
XMigra::SubversionSpecifics::PRODUCTION_PATH_PROPERTY
Instance Attribute Summary collapse
Instance Method Summary
collapse
#branch_identifier, #branch_use, #check_working_copy!, #get_conflict_info, init_schema, manages, #production_pattern, #production_pattern=, #resolve_conflict!, run_svn, #subversion, #subversion_info, #subversion_retrieve_status, #vcs_changes_from, #vcs_comparator, #vcs_contents, #vcs_file_modified?, #vcs_information, #vcs_latest_revision, #vcs_most_recent_committed_contents, #vcs_move, #vcs_production_contents, #vcs_remove, #vcs_uncommitted?
Constructor Details
388
389
390
391
392
393
394
395
396
|
# 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
|
Instance Attribute Details
Returns the value of attribute history.
398
399
400
|
# File 'lib/xmigra/vcs_support/svn.rb', line 398
def history
@history
end
|
#most_recent_commit ⇒ Object
Returns the value of attribute most_recent_commit.
398
399
400
|
# File 'lib/xmigra/vcs_support/svn.rb', line 398
def most_recent_commit
@most_recent_commit
end
|
Returns the value of attribute path.
398
399
400
|
# File 'lib/xmigra/vcs_support/svn.rb', line 398
def path
@path
end
|
Instance Method Details
#copying_element(log_doc) ⇒ Object
445
446
447
448
449
450
451
|
# 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) ⇒ Object
435
436
437
438
439
440
441
442
443
|
# 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 ⇒ Object
423
424
425
|
# File 'lib/xmigra/vcs_support/svn.rb', line 423
def earliest_loaded_repopath
history[0][0]
end
|
#earliest_loaded_revision ⇒ Object
431
432
433
|
# File 'lib/xmigra/vcs_support/svn.rb', line 431
def earliest_loaded_revision
history[0][1]
end
|
#earliest_loaded_url ⇒ Object
427
428
429
|
# File 'lib/xmigra/vcs_support/svn.rb', line 427
def earliest_loaded_url
@root_url + history[0][0]
end
|
#history_exhausted? ⇒ Boolean
419
420
421
|
# File 'lib/xmigra/vcs_support/svn.rb', line 419
def history_exhausted?
@next_query[1] <= 0
end
|
#load_parent_commit ⇒ Object
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
|
# 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 ⇒ Object
453
454
455
|
# 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
|