def handle_data(state, stream, text)
host = state[:channel][:host]
logger.info "[#{host} :: #{stream}] #{text}"
case text
when /^user:/mi
if user = variable(:scm_username) || variable(:scm_user)
"#{user}\n"
else
raise "No variable :scm_username specified and Mercurial asked!\n" +
"Prompt was: #{text}"
end
when /\bpassword:/mi
unless pass = scm_password_or_prompt
raise "No variable :scm_password specified and Mercurial asked!\n" +
"Prompt was: #{text}"
end
"#{pass}\n"
when /yes\/no/i
"yes\n"
end
end