def query_revision(revision)
internal_revision = InternalRevision.parse(revision)
return revision unless internal_revision.psuedo_revision?
logger.debug("Querying for real revision for #{internal_revision}")
rev_stream = internal_revision.stream
logger.debug("Determining what type of stream #{rev_stream} is...")
stream_xml = yield show_streams_for(rev_stream)
stream_doc = Document.new(stream_xml)
type = XPath.first(stream_doc, '//streams/stream/@type').value
case type
when 'snapshot'
InternalRevision.new(rev_stream, 'highest').to_s
else
logger.debug("Getting latest transaction id in #{rev_stream}")
hist_xml = yield scm(:hist, '-ftx', '-s', rev_stream, '-t', 'now.1')
hist_doc = Document.new(hist_xml)
transaction_id = XPath.first(hist_doc, '//AcResponse/transaction/@id').value
InternalRevision.new(stream, transaction_id).to_s
end
end