How to get logs using subversion python bindings(svn.libsvn)

satheesh
satheesh
Hi,   I created python script to get logs for given url using python bindings for subversion,  import sys import os.path import svn.fs, svn.core, svn.repos, svn.client   print "Hello" repos_url = "https://localhost/svn/Test_Mirror/trunk"   svn.core.apr_initialize() pool = svn.core.svn_pool_create(None) svn.core.svn_config_ensure( None, pool ) config = svn.core.svn_config_get_config( None, pool )  src_url = ("https://localhost/svn/Test_Mirror/trunk","https://localhost/svn/Test_Mirror/trunk/Test1") _start_rev = svn.core.svn_opt_revision_t()  _start_rev.kind = svn.core.svn_opt_revision_head  #_start_rev.number = 55  _end_rev = svn.core.svn_opt_revision_t()  _end_rev.kind = svn.core.svn_opt_revision_head  #_end_rev.number = 67    client_ctx = svn.client.svn_client_create_context() client_ctx.auth_baton = svn.core.svn_auth_open([], pool)  client_ctx.config = config   #remote_ls = svn.client.svn_client_ls(repos_url, _start_rev, 0, client_ctx,pool)  Out = svn.client.svn_client_log(src_url, _start_rev, _end_rev, False, False, None, None, pool )   It shows following error,  svn.core.SubversionException: 200009 - 'https://localhost/svn/Test_Mirror/trunk/Test1' is not a relative path  In starting python getting crashed without any error ? after changing some code getting above error...

Last updated

linuxtampa
linuxtampa
I am able to access the svn commit log with another python svn binding (pysvn). Hope this snippet helps.  This is on an Ubuntu 12.10 VM. I'm not advocating pysvn over svn.fs. I just happened to try pysvn first, and got it working quickly. Hope it helps!    import pysvn  import re  import sys    url = 'svn://my-svn-host/myrepo'    def get_login( realm, username, may_save ):   return True, 'username', 'password', False    client = pysvn.Client()  client.callback_get_login = get_login    commit_messages = client.log(url)  for i, commit in enumerate(commit_messages):   print i, commit.revision, commit.author, commit.date
linuxtampa
linuxtampa
The name svn.fs tells me that it is intended to work on the repository itself, and not be a network client of a running svnserve instance. pysvn is a network client, not a tool to manipulate the svn repo directly.  So, if you change your URL to a file path on the svn server, you'll probably get it to do what you want.

1-3 of 3

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.