import svn.ra, svn.client, svn.delta
from svn.core import Pool, svn_config_get_config

def _create_auth_baton(pool):
    providers = [
        svn.client.get_simple_provider(pool),
        svn.client.get_username_provider(pool),
        svn.client.get_ssl_client_cert_file_provider(pool),
        svn.client.get_ssl_client_cert_pw_file_provider(pool),
        svn.client.get_ssl_server_trust_file_provider(pool),
    ]
    return svn.core.svn_auth_open(providers, pool)

url = "https://bzr-svn-test.googlecode.com/svn/trunk"

pool = Pool()
client = svn.client.create_context(pool)
client.config = svn_config_get_config(None)
client.auth_baton = _create_auth_baton(pool)
ra = svn.client.open_ra_session(url, client, pool)
base_revnum = svn.ra.get_latest_revnum(ra)
def done(revision, date, author):
    pass
(editor, edit_baton) = svn.ra.get_commit_editor(ra, 
    "Commit Message".encode("utf-8"), done, None, False)
root = svn.delta.editor_invoke_open_root(editor, edit_baton, base_revnum)
file = svn.delta.editor_invoke_add_file(editor, "afile", root, None, -1, pool)
(txdelta, txbaton) = svn.delta.editor_invoke_apply_textdelta(editor, file, None, pool)
svn.delta.svn_txdelta_send_string("", txdelta, txbaton, pool)
svn.delta.editor_invoke_close_file(editor, file, None, pool)
svn.delta.editor_invoke_close_directory(editor, root)
svn.delta.editor_invoke_close_editor(editor, edit_baton)
